Skip to content

Commit

Permalink
Strong parameters in controller for generated refinery forms
Browse files Browse the repository at this point in the history
  • Loading branch information
ghoppe authored and simi committed Apr 14, 2015
1 parent d6d92b6 commit 2e6bb6c
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -18,7 +18,7 @@ module Refinery
end

def create
@<%= singular_name %> = <%= class_name %>.new(params[:<%= singular_name %>])
@<%= singular_name %> = <%= class_name %>.new(<%= singular_name %>_params)

if @<%= singular_name %>.save
begin
Expand All @@ -45,6 +45,10 @@ module Refinery

protected

def <%= singular_name %>_params
params.require(:<%= singular_name %>).permit(<%= attributes.map { |a| ":" << a.name }.join(", ") %>)
end

def find_page
@page = Refinery::Page.where(link_url: "/<%= plural_name %>/new").
includes(:parts).first_or_create!
Expand Down

0 comments on commit 2e6bb6c

Please sign in to comment.