vendor/plugins/refinery/lib/generators/refinery/templates/public_controller.rb in refinerycms-0.9.6.1 vs vendor/plugins/refinery/lib/generators/refinery/templates/public_controller.rb in refinerycms-0.9.6.2
- old
+ new
@@ -1,23 +1,28 @@
class <%= class_name.pluralize %>Controller < ApplicationController
+ before_filter :find_all_<%= plural_name %>
before_filter :find_page
def index
- @<%= plural_name %> = <%= class_name %>.find(:all, :order => "position ASC")
+ # 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
- @<%= plural_name %> = <%= class_name %>.find(:all, :order => "position ASC") # for body_content_right
@<%= 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 %>
+ @<%= plural_name %> = <%= class_name %>.find(:all, :order => "position ASC")
+ end
def find_page
@page = Page.find_by_link_url("/<%= plural_name %>")
end
\ No newline at end of file