User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 2]]
Follow Load (0.2ms) SELECT "follows".* FROM "follows" WHERE "follows"."follower_id" = 2 AND "follows"."follower_type" = 'User' AND "follows"."blocked" = 'f'
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (1)
Conference Load (0.1ms) SELECT "conferences".* FROM "conferences" WHERE "conferences"."id" IN (4)
=> [#<Follow id: 8, followable_id: 1, followable_type: "User", follower_id: 2, follower_type: "User", blocked: false, created_at: "2013-08-28 06:57:17", updated_at: "2013-08-28 06:57:17">, #<Follow id: 9, followable_id: 4, followable_type: "Conference", follower_id: 2, follower_type: "User", blocked: false, created_at: "2013-08-28 07:03:35", updated_at: "2013-08-28 07:03:35">]
これは、試したときにコンソールに表示される出力です
User.find(2).all_follows
followable_type: "Conferece" の行を取得したい。
私はこれを試しました
User.find(2).all_follows.find(:conditions => ["followable_type = ?", "Conference"])
と
User.find(2).all_follows.where(:all, :conditions => ["followable_type = ?", "Conference"])
whereを使用すると、そのような機能はありませんと表示されます。しかし、入力後にタブを押すと、次の出力が得られます
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=