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) or a variable name which I assign result(person =
current_account.people.find(params[:id])) or maybe it should be an
object attribute like @person??? Because I used various types but always
have the same error.
The second question - is it necessary to give the same name for private
method def person_params as the name of (person_params) for db update?
thx

class PeopleController < ActionController::Base

  def update
    person = current_account.people.find(params[:id])
    person.update_attributes!(person_params)
    redirect_to person
  end

  private

    def person_params
      params.require(:person).permit(:name, :age)
    end
end

-- 
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+unsubscr...@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/24a76b1e95a0a63570c399f999b20ead%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to