房子模型在軌方法,每個循環
class House < ActiveRecord::Base
has_many :categories, :through => :category_join_table
def features_to_html_class
"#{price} #{rooms} #{guests} #{{categories.name do |cat| cat.name}}"
end
end
衆議院指數模板
- @houses.each do |house|
.item{:class => house.features_to_html_class }
值的價格,客房,客人正確的觀點(過濾目的)解析,而不是類別。我做錯了什麼?
請[不簽名或標語添加到您的帖子(HTTP: //stackoverflow.com/faq#signatures) – meagar