我试图使用new Active Record Query Interface为Rails 3错误尝试使用新的活动记录查询界面中的Rails 3
我的老样式的查询是
my_notes = Note.find(:all, :conditions => { :user_id => current_user.id, :date => p[:date] }, :order => "date ASC, created_at ASC")
在新的风格时,我认为这将是:
my_notes = Note.find_all_by_user_id_and_date(current_user.id, p[:date]).order('date ASC, created_at ASC')
,但我得到这个错误:
NoMethodError in NotesController#play
undefined method `order' for #<Array:0x00000103d23c38>
我在做什么错?谢谢阅读。
看来,'find_all'返回数组。也许你可以切换到“哪里”? – 2010-11-18 10:35:06