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 8904187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:03:48+00:00 2026-06-15T02:03:48+00:00

I am new to RoR and I thought I could ask you some help.

  • 0

I am new to RoR and I thought I could ask you some help. I didn’t find the specific answer I am looking for.

I have a problem with a modelisation I want to make using Devise. Devise sets up a Member model, and I want to have a SuperMember model which have more attributes than Member, and some different views.

I want to set up a nested form to create a SuperMember, while automatically creating the Member account in the background.

Member.rb (generated by devise)

class Member < ActiveRecord::Base
  devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
  attr_accessible :email, :password, :password_confirmation, :remember_me
end

SuperMember.rb

class Supermember < ActiveRecord::Base
  attr_accessible :first_name, :last_name
  belongs_to :member, :dependent => :destroy
  accepts_nested_attributes_for :member
end

Supermembers.controllers.rb

def new
@supermember = Supermember.new
  @supermember.member = Supermember.build

  respond_to do |format|
    format.html # new.html.erb
    format.json { render json: @supermember }
  end
end

def create
  @supermember = Supermember.new(params[:supermember])

  respond_to do |format|
  if @supermember.save
    format.html { redirect_to @supermember, notice: 'Supermember was successfully created.' }
    format.json { render json: @supermember, status: :created, location: @supermember }
  else
    format.html { render action: "new" }
    format.json { render json: @supermember.errors, status: :unprocessable_entity }
  end
end

I tried to create a nested form in order to generate both the member and the supermember :

<%= simple_form_for(@supermember) do |f| %>
  <%= f.error_notification %>

  <div class="form-inputs">
    <%= f.input :first_name %>
    <%= f.input :last_name %>
  </div>

    <% # Devise member %>
    <%= f.fields_for :member do |m| %>
  <div class="form-inputs">
    <%= m.input :email, :required => true, :autofocus => true %>
    <%= m.input :password, :required => true %>
    <%= m.input :password_confirmation, :required => true %>
  </div>
    <% end %>

  <div class="form-actions">
    <%= f.button :submit %>
  </div>
<% end %>

The problem is that when I submit this form, I get the following error message :

Can't mass-assign protected attributes: member_attributes

Application Trace | Framework Trace | Full Trace
  app/controllers/supermembers.rb:44:in `new'
  app/controllers/supermembers.rb:44:in `create'

I really don’t understand how to fix it. Could you help me on this one?
Thank you very much!

  • 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-15T02:03:50+00:00Added an answer on June 15, 2026 at 2:03 am

    You need to allow Supermember to accept mass assignment of the member attributes

    class Supermember < ActiveRecord::Base
      attr_accessible :first_name, :last_name, :member_attributes
      ...
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to ROR, so this could be a very simple problem. I have
I am new to RoR, any help would be greatly appreciated :) I have
Am new to RoR paperclip gem and i have been trying out some examples
We are new to ROR, We have issue in creating Login/Logout process in ROR
I'm quite new to RoR. Sorry if I'm using wrong terminology or the answer
I'm new with RoR and I have a controller ( UsersController ) where I
I have an almost new setup of ROR 3.1 here and have already generated
I'm pretty new to RoR programming. I remember reading on some tutorial (forgot which)
I am completely new to RoR. I have a parameter in one view of
i am new to ROR. I am trying to find the online users in

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.