Sha256: cbe3d5c201daa4aef06d554616d23135f3d40dac9c24b15f7f0052e8b7ab2f86
Contents?: true
Size: 825 Bytes
Versions: 4
Compression:
Stored size: 825 Bytes
Contents
class <%= class_name.pluralize %>Controller < ApplicationController before_filter :find_all_<%= plural_name %> before_filter :find_page def index # you can use meta fields from your model instead (e.g. browser_title) # by swapping @page for @<%= singular_name %> in the line below: present(@page) end def show @<%= singular_name %> = <%= class_name %>.find(params[:id]) # you can use meta fields from your model instead (e.g. browser_title) # by swapping @page for @<%= singular_name %> in the line below: present(@page) end protected def find_all_<%= plural_name %> @<%= "all_" if plural_name == singular_name %><%= plural_name %> = <%= class_name %>.order('position ASC') end def find_page @page = Page.where(:link_url => "/<%= plural_name %>").first end end
Version data entries
4 entries across 4 versions & 1 rubygems