0
我添加了一个has_many :through
协会(连接表)到我的房屋模型,因此房子可以有多重的类别,如“最后一分钟”,“房子池”等has_many:通过关联的网址/视图?
我做了一个自定义查询,因此通过例如我(5)
@lastminutes = House.find(:all, :select=>"houses.*", :joins=>"JOIN category_join_tables ON houses.id = category_join_tables.house_id", :conditions=>["category_join_tables.house_id = houses.id AND category_join_tables.category_id = ?", 5])
这个工作很好,在控制台。
什么是最好的方法来让我的网站工作。我想url结构像这样:
domain.com/locale/holidayhouses/lastminutes (house in the lastminute category)
domain.com/locale/holidayhouses/holidayhouses_with_pool (houses in the pool category)
domain.com/locale/lastminutes (houses and appartments in the lastminute category)
任何帮助将是伟大的!