error message: ActiveModel::MassAssignmentSecurity::Error in OrdersController#create

ActiveModel::MassAssignmentSecurity::Error in OrdersController#create

Can’t mass-assign protected attributes: name, address, email
I’m trying and use a book -> Pragmatic Agile Web Development with Rails 4th Edition.

edit the order model app/models/order.rb


class Order < ActiveRecord::Base
has_many :line_items, dependent: :destroy	
attr_accessible :name, :address, :email, :pay_type

end

adding :name, :address, :email to the attr_accessible line in the order model

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s