Displaying 1 result from an estimated 1 matches for "get_enabled_task".
Did you mean:
get_enabled_tasks
2011 Apr 17
0
newbie: to_json only/except + association confusion
...t.to_json(:only =>
[:title ], :include=> { :tasks => {:only=>[:id,:title] },, :conditions
=> [''tasks.is_enabled = ?'', 1] } ) }
C) #Not OK > works, but cant use only/except
format.json { render :json => @project.to_json(:only =>
[:title ], :method=> get_enabled_tasks ) }
def get_enabled_tasks
tasks.where("is_enabled = ?", 1)
D)#OK, but json output not nice
format.json { render :json => @project.to_json(:only =>
[:title ], :method=> get_enabled_tasks ) }
def get_enabled_tasks
ActiveRecord::Base.connection.execute(sql)
>>...