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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:20:59+00:00 2026-06-01T15:20:59+00:00

I am using mongoid in rails app. rails 3.0.10 ruby 1.9.2p0 When I am

  • 0

I am using mongoid in rails app. rails 3.0.10 ruby 1.9.2p0

When I am trying to use field like “test”, “link”, “desc” etc.

say

Content.new(:test => 'ggg')

Content.new(:link => 'ggg')

Content.new(:desc => 'ggg')

Content is model which uses “Mongoid::Document”

it gives following error. (this error is for field “test”)

I think mongoid uses some library which contents above field names as functions which

might create problem. Is there any way to come around this problem.

ArgumentError: wrong number of arguments (0 for 2..3)
    from /usr/lib/ruby/gems/1.9.1/gems/activemodel-3.0.10/lib/active_model/dirty.rb:155:in `test'
    from /usr/lib/ruby/gems/1.9.1/gems/activemodel-3.0.10/lib/active_model/dirty.rb:155:in `attribute_will_change!'
    from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes.rb:102:in `block (2 levels) in write_attribute'
    from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes.rb:100:in `tap'
    from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes.rb:100:in `block in write_attribute'
    from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes.rb:170:in `assigning'
    from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes.rb:98:in `write_attribute'
    from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes/processing.rb:95:in `process_attribute'
    from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes/processing.rb:25:in `block in process'
    from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes/processing.rb:23:in `each_pair'
    from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/attributes/processing.rb:23:in `process'
    from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/document.rb:128:in `block in initialize'
    from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/relations/builders.rb:47:in `building'
    from /usr/lib/ruby/gems/1.9.1/gems/mongoid-2.2.4/lib/mongoid/document.rb:125:in `initialize'
    from (irb):1:in `new'
    from (irb):1
    from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/commands/console.rb:44:in `start'
    from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/commands/console.rb:8:in `start'
    from /usr/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/commands.rb:23:in `<top (required)>'
    from /home/harshal/simple-cms/branches/1.0/script/rails:6:in `require'
    from /home/harshal/simple-cms/branches/1.0/script/rails:6:in `<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'
  • 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-01T15:21:01+00:00Added an answer on June 1, 2026 at 3:21 pm

    Using the latest everything, ruby(1.9.3), rails(3.2.3), mongoid(2.4.7) I tried the following things:

    Model with no set fields, all dynamic:

    class Content
      include Mongoid::Document
    end
    

    Rails console:

    1.9.3p125 :011 > c = Content.new(:test => "test", :link=> "link", :desc => "desc")
     => #<Content _id: 4f7f49f5add3617fae000003, _type: nil, test: "test", link: "link", desc: "desc"> 
    1.9.3p125 :012 > c.save
     => true 
    1.9.3p125 :013 > Content.first
     => #<Content _id: 4f7f49f5add3617fae000003, _type: nil, test: "test", link: "link", desc: "desc"> 
    1.9.3p125 :014 >
    

    Model with all fields statically set:

    class Content
      include Mongoid::Document
      field :test, :type => String
      field :link, :type => String
      field :desc, :type => String
    end
    

    Rails console again:

    Loading development environment (Rails 3.2.3)
    1.9.3p125 :001 > c = Content.new
     => #<Content _id: 4f7f4652add3617ec4000001, _type: nil, test: nil, link: nil, desc: nil> 
    1.9.3p125 :002 > c.test = 'tyler'
     => "tyler" 
    1.9.3p125 :003 > c.save
     => true 
    1.9.3p125 :004 > Content.first
     => #<Content _id: 4f7f4652add3617ec4000001, _type: nil, test: "tyler", link: nil, desc: nil>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was writing a Blog like application Using Rails3/Mongoid, and now trying to use
I have a Rails 3.1 app, running on Ruby 1.9.2, Mongo 2.0.2, using Mongoid
I'm trying to use the jQuery token input plugin with Rails and Mongoid. Using
I am currently working on a rails app where we are using mongoid/mongoDB on
I would like to write a query in a Rails model using mongoid, and
I recently played with MongoDB in Rails using Mongoid . I like the ability
I've been trying to use Mongoid with Rails on Ubuntu. I have installed mongoDB
I'm writing a ruby on rails application using mongoid and I'm wondering about the
I've got a Rails 3 app (using Mongodb and Mongoid if that makes a
I am using Mongoid on Rails 3 and trying to build a nested form.

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.