Ruby on rails 3 无法在rails控制台中使用条件

Ruby on rails 3 无法在rails控制台中使用条件,ruby-on-rails-3,Ruby On Rails 3,我想得到以下类型的行:“Conference” 我试过这个 User.find(2).all_follows 及 当我使用where时,它说没有这样的函数。但当我在输入后点击tab时,我得到了以下输出 User.find(2).all_follows.where(:all, :conditions => ["followable_type = ?", "Conference"]) 试试这个 User.find(2).all_follows.where 2).all_follows.w

我想得到以下类型的行:“Conference”

我试过这个

User.find(2).all_follows

当我使用where时,它说没有这样的函数。但当我在输入后点击tab时,我得到了以下输出

 User.find(2).all_follows.where(:all, :conditions => ["followable_type = ?", "Conference"])
试试这个

User.find(2).all_follows.where
2).all_follows.where              2).all_follows.where_sql                
2).all_follows.where_values=      2).all_follows.wheres
2).all_follows.where_clauses      2).all_follows.where_values              
2).all_follows.where_values_hash  2).all_follows.wheres=

它将返回用户跟踪的所有人员和会议。我使用这个函数是因为我使用了act_as_follow,Gei可以看到,但它是一个作用域(或返回作用域的东西)还是一个数组?还显示确切的错误消息-它可能是在抱怨,因为
的参数不正确,提供了
所有方法的定义。你用的是哪种铁轨?可能您的方法没有返回ActiveRelation,因此您不能向其追加作用域。我认为它返回一个数组。我用同样的方法试过。最后一次也是。但它仍然不起作用。仍然说where()方法不是它知道的方法。这是我得到的错误nomethoder错误:未定义的方法'where',for#@Aravind编辑了我的答案。。试试这个
 User.find(2).all_follows.where(:all, :conditions => ["followable_type = ?", "Conference"])
User.find(2).all_follows.where
2).all_follows.where              2).all_follows.where_sql                
2).all_follows.where_values=      2).all_follows.wheres
2).all_follows.where_clauses      2).all_follows.where_values              
2).all_follows.where_values_hash  2).all_follows.wheres=
 User.find(2).all_follows.select{ |user| user.followable_type == "Conference" }