Ruby on Rails Tuesday, January 26, 2016

Colin Law wrote in post #1180931:
> On 26 January 2016 at 20:20, Andrew Dig <lists@ruby-forum.com> wrote:
>> Hi everyone. I'm new in ruby and recently faced with mass assignment
>> problem. Below I attached a sample code similar to mine. Could you
>> explain me what should I use in require method??? is it a name of
>> model(person)
>
> Normally it is the name of the model, as in the example shown.
> If you can't get that to work show us some code (just the relevant
> bits, should not need more than a dozen lines or so) and the error you
> are getting.
>
> Colin

def contact
if params.present?
item_params = params[:data]
item = Page.create(item_params)
end
render 'index/contact'
end

private

def item_params
params.require(:item).permit(:name,:description)
end

Attachments:
http://www.ruby-forum.com/attachment/11243/1453873666654.jpg


--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/69f7aa7d1c7247b0705ea623a4ea4030%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment