app/controllers/simple_pages/pages_controller.rb in simple-pages-rails-0.5.0 vs app/controllers/simple_pages/pages_controller.rb in simple-pages-rails-0.6.0
- old
+ new
@@ -36,11 +36,11 @@
end
respond_with @page
end
def update
- @page.update_attributes params[:page]
+ @page.update_attributes page_params
if @page.invalid?
load_page_options
end
respond_with @page
end
@@ -50,11 +50,19 @@
respond_with @page
end
protected
+ def page_params
+ if params.respond_to? :permit and params.has_key? :page
+ params.require(:page).permit(SimplePages.permitted_fields)
+ else
+ params[:page]
+ end
+ end
+
def new_page
- @page = SimplePages::Page.new params[:page]
+ @page = SimplePages::Page.new page_params
end
def load_page_options
load_author_options
load_page_layout_at_options