
Untitled
By: a guest on
May 9th, 2012 | syntax:
None | size: 0.44 KB | hits: 13 | expires: Never
I want to create a method that will be available in all controllers, and views
def categories
@categories = Category.all
end
def list
categories
@products = Product.order('title').page(params[:page]).per(4)
end
helper_method :my_method
module ApplicationHelper
def get_all_categories
@categories = Category.all
end
end
<% Category.all.each do |category| %>
<% do stuff to display all categories %>
<% end %>