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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:59:01+00:00 2026-05-26T10:59:01+00:00

undefined method `reject’ for 4:String is thrown when I try to perform @user.update_attributes(params). The

  • 0
 undefined method `reject' for "4":String 

is thrown when I try to perform @user.update_attributes(params).

The params list is as follows

"user"=>{"login"=>"admin", "first_name"=>"Admin", "last_name"=>"Admin", "email"=>"nfsurveytest+admin@neurofocus.com", "location_id"=>"1", "last_login_at_text"=>"Never logged in", "password"=>"", "password_confirmation"=>"", "role_ids"=>"4", "active"=>"true", "is_staff"=>"true"},

The error stack is as below

/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14   /lib/active_record/associations.rb:1336:in block in collection_accessor_methods'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/base.rb:2918:inblock in assign_attributes'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/base.rb:2914:in each'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/base.rb:2914:inassign_attributes'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/li b/active_record/base.rb:2787:in attributes='
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/base.rb:2671:inupdate_attributes_inside_transaction'
 /home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/transactions.rb:229:in block in with_transaction_returning_status'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/database_statements.rb:136:intransaction'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/transactions.rb:182:in transaction'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/transactions.rb:228:inwith_transaction_returning_status'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/base.rb:2667:in update_attributes'
/home/narendra/workspace/nf_schedule/app/controllers/users_controller.rb:100:inupdate'

I assume this breaks as String in ruby 1.9.2 does not mixin ‘Enumerable’.
Can anyone confirm if this is an issue or I am missing something?

https://github.com/rails/rails/issues/3434

  • 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-05-26T10:59:01+00:00Added an answer on May 26, 2026 at 10:59 am

    You’re supplying a String where ActiveRecord is expecting an Array. You could remap the offending parameter in the controller using something like this:

    if (params[:user])
      params[:user][:role_ids] = [ params[:user][:role_ids] ]
    end
    

    You could also adjust your form so that the field is named role_ids[] instead of just role_ids so that it will be submitted as an array.

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

Sidebar

Related Questions

Can any one volunteer why the class below fails? ... src/model/user.rb:18: undefined method `set_schema'
I get this error when trying to register a new user. NoMethodError (undefined method
I'm getting undefined method 'social_system' for #User:0x000001052e2ad8 . I thought i'd be using the
Does anyone know why I get undefined method `my_method' for #<MyController:0x1043a7410> when I call
I just ran across the following error: (.gnu.linkonce.[stuff]): undefined reference to [method] [object file]:(.gnu.linkonce.[stuff]):
I have a problem where a method is getting an undefined variable error, even
undefined method `<' for nil:NilClass the line the error occurs on @object.expires_at < Date.today
My error: Notice the undefined method '-@' . This is for a sort by.
Fatal error: Call to undefined method CI_DB_mysql_driver::num_rows() in C:\Development\Zend\Apache2\htdocs\system\application\controllers\signup.php on line 47 Can anyone
I am getting undefined method [] for true:TrueClass error while running the rake task

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.