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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:23:59+00:00 2026-06-16T23:23:59+00:00

I am following Lynda ruby on rails tutorial. Here is the code I have

  • 0

I am following Lynda ruby on rails tutorial.

Here is the code I have to run “subject = Subject.new(:name => “First Subject”, :position => 1, :visible => true)”

This is my error message:

ActiveModel::MassAssignmentSecurity::Error: Can't mass-assign protected attributes: name, position, visible
    from /Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activemodel-3.2.9/lib/active_model/mass_assignment_security/sanitizer.rb:48:in `process_removed_attributes'
    from /Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activemodel-3.2.9/lib/active_model/mass_assignment_security/sanitizer.rb:20:in `debug_protected_attribute_removal'
    from /Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activemodel-3.2.9/lib/active_model/mass_assignment_security/sanitizer.rb:12:in `sanitize'
    from /Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activemodel-3.2.9/lib/active_model/mass_assignment_security.rb:230:in `sanitize_for_mass_assignment'
    from /Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.9/lib/active_record/attribute_assignment.rb:75:in `assign_attributes'
    from /Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/activerecord-3.2.9/lib/active_record/base.rb:497:in `initialize'
    from (irb):9:in `new'
    from (irb):9
    from /Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.9/lib/rails/commands/console.rb:47:in `start'
    from /Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.9/lib/rails/commands/console.rb:8:in `start'
    from /Users/lexi87/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.2.9/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Here is my subject.rb from models:

class Subject < ActiveRecord::Base
# attr_accessible :title, :body, :name, :position, :visible
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-16T23:24:00+00:00Added an answer on June 16, 2026 at 11:24 pm

    You are need to uncomment attr_accessible, line which starts with # character ignored by the interpreter

       class Subject < ActiveRecord::Base
            attr_accessible :title, :body, :name, :position, :visible
        end
    

    Can’t mass-assign protected attributes: name, position, visible

    attr_accessible specifies a list of attributes that can be set via mass-assignment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am following Lynda ruby on rails tutorial. I have already ran the code
So I'm new to rails and am actually following a video tutorial from Lynda.com
I'm following the guides in a Lynda program teaching Ruby on Rails. The guy
I'm following a Lynda tutorial and trying to implement OnClickListener in my MainActivity class.
I have the following code which grabs two separate arrays, flips the surname and
Following this post Factory Girl If you can’t upgrade to Ruby 1.9 and Rails
Following code working: function() { var Marker = new google.maps.Marker(); var MarkerOptions = {};
Just started ROR Lynda Tutorial, Error while trying to execute the rails server in
Consider the following code below, I've been thought by Lynda.com to create a database
Following is my code WebClient webClient = new WebClient(); HtmlPage page = webClient.getPage(http://www.cheapoair.com/); String

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.