I have a Shift and a Type table with the following relations:
class Shift < ActiveRecord::Base
belongs_to :type
end
class Type < ActiveRecord::Base
has_many :shifts, :dependent => :destroy
end
The Type table has a attribute called Unassignable.
I would like to do a query which returns all the Shifts which belongs to a Type where the Unassignable attribute is true..
Something like:
Shift.where(:shift.type.unassignable => true)
Any help 🙂
Thanks
1 Answer