私は次のモデルを持っています:
class Constraint < ActiveRecord::Base
belongs_to :constraint_category
end
class ConstraintCategory < ActiveRecord::Base
has_many :constraints
end
モデルには次の属性があります (db/schema.rb から):
create_table "constraint_categories", :force => true do |t|
t.string "value"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.boolean "active"
end
create_table "constraints", :force => true do |t|
t.string "phrase"
t.integer "constraint_category_id", :limit => 255
t.boolean "active"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
"active" 属性が "true" で "constraint_category.value" が "名詞" であるすべての制約を検索するクエリを作成したいと思います。
そこに着くためのアドバイスがあれば幸いです。