unknown attribute error in ruby on rails 4 <p>I have a user model and a friend model (friend inherits from user class). A user has many friends through the friendships join model. </p> <p>The user can also create messages and send them to their friends. I want to be able to track which messages are sent to which friends. So I've created a message model which is joined with the friendships model to create the associated sent_messages model.</p> <pre><code>class User &lt; ActiveRecord::Base has_many :friendships has_many :friends, :through =&gt; :friendships has_many :messages end class Friendship &lt; ActiveRecord::Base belongs_to :user belongs_to :friend, :class_name =&gt; 'User' has_many :sent_messages has_many :messages, :through =&gt; :sent_messages end class Message &lt; ActiveRecord::Base belongs_to :user has_many :sent_messagess has_many :friendships, :through =&gt; :sent_messages end class SentMessage &lt; ActiveRecord::Base belongs_to :message belongs_to :friendship end </code></pre> <p>In the message creation form there will be a text box for data and a checkbox listing all the friends of a user they can choose to send the message to. </p> <pre><code>&lt;%= form_for @message, url: user_messages_path do |f| %&gt; &lt;div class="form-group"&gt; &lt;%= f.text_field :title %&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;%= f.text_area :message %&gt; &lt;/div&gt; &lt;% Friendship.all.each do |friendship| -%&gt; &lt;div&gt; &lt;%= check_box_tag('message[friendships_id][]',friendship.id,@message.friendships.include?(friendship.id))%&gt; &lt;%= label_tag friendship.friend_username %&gt; &lt;/div&gt; &lt;% end -%&gt; &lt;div class="actions"&gt; &lt;%= f.submit "Send", class: 'btn btn-primary' %&gt; &lt;/div&gt; &lt;% end %&gt; </code></pre> <p>Here is the messages controller</p> <pre><code>class MessagesController &lt; ApplicationController before_action :authenticate_user! def create @message = Message.new(message_params) if @message.save redirect_to action: "show", id: @message.id else respond_to do |format| format.html format.js end end end private def message_params params.require(:message).permit(:title,:message,:friendships_id =&gt; []) end end </code></pre> <p>Here is the schema</p> <pre><code> create_table "messages", force: true do |t| t.integer "user_id" t.string "title" t.text "message" end create_table "sent_messages", force: true do |t| t.integer "message_id" t.integer "friendships_id" end create_table "friendships", force: true do |t| t.integer "user_id" t.integer "friend_id" t.string "friend_username" end </code></pre> <p>When I submit a message, i get the error "unknown attribute: friendships_id" Not sure how to correct this.</p>