如果我像这样添加订单选项,错误会说
undefined method `call' for # 我该如何解决这个问题?
我在控制器中的代码是
@communities = current_user.get_up_voted Community.(order: 'updated_at DESC').page(params[:page]).per(5)
如果我像这样添加订单选项,错误会说
undefined method `call' for # 我该如何解决这个问题?
我在控制器中的代码是
@communities = current_user.get_up_voted Community.(order: 'updated_at DESC').page(params[:page]).per(5)
我想也许你有 order 错误的语法:
http://guides.rubyonrails.org/active_record_querying.html#ordering
尝试:
Community.order("updated_at DESC")