pwz2000
pwz2000

Reputation: 1395

Can't mass-assign protected attributes for Message

In the development logs I am getting this message:

WARNING: Can't mass-assign protected attributes for Message: notification_id, receiver_id, conversation_id
    app/controllers/questions_controller.rb:21:in `create'
    app/controllers/application_controller.rb:13:in `user_time_zone'

I am wondering how I can correct this as I am using rails 4. I have tried adding to the attr_accessible in the User model but that does not make a difference. Any ideas?

Upvotes: 0

Views: 53

Answers (1)

jakenberg
jakenberg

Reputation: 2113

:You need to add your attr_accessible to your Message model:

class Message < ActiveRecord::Base
  attr_accessible :notification_id, :receiver_id, :conversation_id
end

Upvotes: 1

Related Questions