Displaying 1 result from an estimated 1 matches for "faqscontrol".
Did you mean:
fancontrol
2006 May 04
2
Building a FAQ
...ucts, :through => :faqs, :select => ''DISTINCT products.*''
acts_as_list
end
class Faq < ActiveRecord::Base
belongs_to :product
belongs_to :category
acts_as_list :scope => :category
end
And I''d like to do something like this:
--- Controler ---
class FaqsController < ApplicationController
def show
@categories = Product.find(1).categories
End
end
--- View ---
<% for category in @categories %>
<h3>category.name</h3>
<% for faq in @category.faqs %>
<p><b><%= faq.question %></b></p>...