added rails&sql stuff for model