집 모델각 루프
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