sortable - where does rails get the queries for nested objects? -
i've got nice 3-level nested-form using formtastic_cocoon (jquery), , want able sort 2nd set of items in form.
i've got jquery ui working no problem, set , update sort order in rails.
i started following rails bits of railscasts sortable lists http://asciicasts.com/episodes/147-sortable-lists
the form structure user->tasks->location.
in task model set index
def index @task = task.find(params[:id],:order=>'position') end def edit @task = task.find(params[:id],:order=>'position') end
and expecting console see
... 'tasks' ('users'.'id' = 12) order ('position')
or along lines, there no order output.
is there somewhere else need define order?? nested_object relationship from? model only?
my models
class user < activerecord::base has_many :tasks end class task < activerecord::base belongs_to :user end
i changed model
class user < activerecord::base has_many :tasks, :order=>'position' end
Comments
Post a Comment