Sha256: 4220353e799411733a978a911b90f3a5de53457a94feb23db3487a5b282ee29e
Contents?: true
Size: 981 Bytes
Versions: 11
Compression:
Stored size: 981 Bytes
Contents
module Refinery module <%= namespacing %> class <%= class_name.pluralize %>Controller < ::ApplicationController before_action :find_all_<%= plural_name %> before_action :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 = ::Refinery::Page.where(:link_url => "/<%= plural_name %>").first end end end end
Version data entries
11 entries across 11 versions & 1 rubygems