Displaying 2 results from an estimated 2 matches for "house_id".
Did you mean:
horse_id
2006 Apr 13
7
Complex SQL in paginate command?
...I''d like to be
able to filter out all the houses without any associated images.
So far I''m doing this by constructing a SQL query that goes something
like this--an example using a maximum price:
"select distinct h.* from houses h, images i where price < 1000000 and
i.house_id = h.id order by price desc"
I''m not sure how to paginate this query. Is it possible? Is there a
simpler way to filter out all the houses without an associated image
from a search?
Thanks,
Jeff Coleman
--
Posted via http://www.ruby-forum.com/.
2006 Jun 19
3
Strange behavior of :through association.
class Host < ActiveRecord::Base
belongs_to :person
end
class House < ActiveRecord::Base
has_many :people, :dependent => true
has_many :hosts, :through => :person
end
class Person < ActiveRecord::Base
belongs_to :house
has_many :hosts, :dependent => true
end
Now when I try to do:
@hosts = House.find_by_id(params[:namas]).hosts
from my controller I get this: