I am upgrading my Rails app from Rails 3.2.8 to Rails 4.0.0 following RailsCast #415 (http://railscasts.com/episodes/415-upgrading-to-rails-4?view=asciicast) and all is good until I upgrade to strong parameters. After updating the Events controller to use strong parameters I'm able to submit a form to create a new Event (no validation errors are thrown) but all the submitted params are null and the terminal log (running locally) says,
WARNING: Can't mass-assign protected attributes for Event: street, description, host_name, event_date(1i), event_date(2i), event_date(3i), event_time(1i), event_time(2i), event_time(3i), event_time(4i), event_time(5i), event_name, end_time(1i), end_time(2i), end_time(3i), end_time(4i), end_time(5i)
so obviously I am having a mass assignment problem and the strong parameters are not working properly.
The Events controller has the following private method:
private
def event_params
params.require(:event).permit(:city, :state, :street, :zip, :description,
:host_name, :host_contact, :event_date, :event_time,
:instructions, :event_name, :end_time)
end
And the event#create action looks like (created with a scaffold):
def create
@event = Event.new(event_params)
respond_to do |format|
if @event.save
format.html { redirect_to @event, notice: 'Event was successfully created.' }
format.json { render json: @event, status: :created, location: @event }
else
format.html { render action: "new" }
format.json { render json: @event.errors, status: :unprocessable_entity }
end
end
end
The gemfile has the following gem included for use during the transition: gem 'protected_attributes'
and the application.rb file has whitelist_attributes set to false (it's commented out):
# config.active_record.whitelist_attributes = true
Any help in what I'm missing to connect the dots here would be helpful. Thanks.