<meta http-equiv="content-type" content="text/html;
I have two doubts about the right way / place to write some code.
I have a product and in the view I need to show a listbox with all the categories of this product.
- Option1: in the controller make "@product_categories = ProductCategori.all" and later in the view make "<%= f.collection_select(:product_category_id, @product_categories, :id, :name) %>"
- Option2: in the view just write "<%= f.collection_select(:product_category_id, ProductCategori.all, :id, :name) %>"
I need to list products with some complex logic
- Option1: in the controller make "@products = Products.list(param1, param2)" and in the model "def self.list(param1, param2)" with all the options joins, where, ...
- Option2: Put all the logic in the controller and avoid calling the model
-- Miquel C. Escarré http://railsdynamics.blogspot.com +34 699 73 22 46 [email protected]
You received this message because you are subscribed to the Google
Groups “Ruby on Rails: Talk” group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at