Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7821719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:43:51+00:00 2026-06-02T07:43:51+00:00

I have a devise model that embeds many for two other models called has_skills

  • 0

I have a devise model that embeds many for two other models called has_skills and desires_skills. The attr-accessibles are in place but I still get a WARNING: Can’t mass-assign protected attributes: my_skills_attributes, wanted_skills_attributes error message. Below are my models. Thoughts?

class User
  include Mongoid::Document

  embeds_many :wanted_skills
  embeds_many :my_skills
  accepts_nested_attributes_for :my_skills, allow_destroy: true
  accepts_nested_attributes_for :wanted_skills, allow_destroy: true

    .........
  attr_accessible :first_name, :last_name, :email, :password, :password_confirmation,     :remember_me,  :location, :my_skills, :wanted_skills, :name, :sname

My Skills model

class MySkill
  include Mongoid::Document
  embedded_in :user
  field :name

  attr_accessible  :name
end

My has skills model

class WantedSkill
 include Mongoid::Document
 embedded_in :user
 field :sname
 attr_accessible  :sname

end

Lastly my form

<%= simple_nested_form_for @user do |f| %>

<%= f.fields_for :my_skills do |task| %>
<%= task.label :name %><br />
<%= task.text_field :name %><br />
<%= task.link_to_remove "Remove this task" %>
<% end %>
<p><%= f.link_to_add "Add a task", :my_skills %></p>


<%= f.fields_for :wanted_skills do |task| %>
<%= task.label :sname %><br />
<%= task.text_field :sname %><br />
<%= task.link_to_remove "Remove this task" %>
<% end %>
<p><%= f.link_to_add "Add a task", :wanted_skills %></p>
  <div><%= f.submit "Sign up" %></div>
<% end %>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T07:43:52+00:00Added an answer on June 2, 2026 at 7:43 am

    To make the nested attributes work, you need to allow my_skills_attributes and not my_skills. Thats all.

    attr_accessible :my_skills_attributes
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two models User and Admin(with RailsAdmin) that use Devise. I sign in
I'm working with Rails 3.2.2. And I have a devise model called user. In
I have a Model User from Devise with that relations: user.rb # Relationships references_many
I have one Devise model: User. I am needing two different login views, /login
I have a rails app that is using Devise, with a User model, no
I have a User model that Devise manages - i.e. all users have email
I have a user model that is generated using Devise. I am extending this
I have a devise user model with pro boolean column.I want to build a
I have a sample Rails 3.1.1 application that I have set devise up to
I am using rails3 and gem devise and i have two roles admin and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.