I have a Phone
model nested to Message
model. How can I find all Messages by a given number considering that number
attribute is inside Phone
model and not in Message
?
This is what I currently got
class Message < ActiveRecord::Base
attr_accessible :phone_id
belong_to :phone
end
class Phone < ActiveRecord::Base
attr_accessible :phone
has_many :messages
end