2017-07-02 100 views

回答

2

Error: Couldn't find all Movies with 'id': (all, {:order=>"title"})

@movies = Movie.find(:all, :order => (params[:sort])) 

这是因为上面的查询只在Rails的2.X及以上的作品。在后期版本的Rails中查询不起作用!

Checked here, and the first snippet seems it should valid: https://apidock.com/rails/ActiveRecord/Base/find/class

您正在寻找进入旧版本的Rails(2.3.8)的。你可以找到参考到更新的版本here

0

find方法会疑惑,这个参数作为主键的值,在大多数情况下是id,所以你应该提供的ID,因为在大多数情况下,整型,字符串或数组。

相关问题