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)
任何幫助將是偉大的!