Closed phoet closed 11 years ago
Would you mind pasting in the whole stack trace?
rspec swallows a lot of it, but this is the stack from the rails console:
NoMethodError: private method `initialize_dup' called for #<Event:0x007fed83101c60>
from /Users/paule/.rvm/gems/ruby-2.0.0-p0@on_ruby/gems/activemodel-3.2.12/lib/active_model/attribute_methods.rb:404:in `method_missing'
from /Users/paule/.rvm/gems/ruby-2.0.0-p0@on_ruby/gems/activerecord-3.2.12/lib/active_record/attribute_methods.rb:149:in `method_missing'
from /Users/paule/.rvm/gems/ruby-2.0.0-p0@on_ruby/gems/activemodel-3.2.12/lib/active_model/validations.rb:179:in `dup'
from /Users/paule/.rvm/gems/ruby-2.0.0-p0@on_ruby/gems/activerecord-3.2.12/lib/active_record/base.rb:562:in `dup'
from /Users/paule/Documents/rails/on_ruby/app/models/event.rb:86:in `duplicate!'
from (irb):1
from /Users/paule/.rvm/gems/ruby-2.0.0-p0@on_ruby/gems/railties-3.2.12/lib/rails/commands/console.rb:47:in `start'
from /Users/paule/.rvm/gems/ruby-2.0.0-p0@on_ruby/gems/railties-3.2.12/lib/rails/commands/console.rb:8:in `start'
from /Users/paule/.rvm/gems/ruby-2.0.0-p0@on_ruby/gems/railties-3.2.12/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
It's indeed a legit bug. Do you want to submit a pull request with a test case for this?
$ rails c
Loading development environment (Rails 3.2.12)
irb(main):001:0> User.create name: 'foo'
(0.0ms) begin transaction
SQL (3.4ms) INSERT INTO "users" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 25 Feb 2013 16:00:43 UTC +00:00], ["name", "foo"], ["updated_at", Mon, 25 Feb 2013 16:00:43 UTC +00:00]]
(0.7ms) commit transaction
=> #<User id: 1, name: "foo", created_at: "2013-02-25 16:00:43", updated_at: "2013-02-25 16:00:43">
irb(main):002:0> User.first.dup
User Load (0.2ms) SELECT "users".* FROM "users" LIMIT 1
NoMethodError: private method `initialize_dup' called for #<User name: "foo", created_at: nil, updated_at: nil>
from /Users/sikachu/.rvm/gems/ruby-2.0.0-p0/gems/activemodel-3.2.12/lib/active_model/attribute_methods.rb:404:in `method_missing'
from /Users/sikachu/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.12/lib/active_record/attribute_methods.rb:149:in `method_missing'
from /Users/sikachu/.rvm/gems/ruby-2.0.0-p0/gems/activemodel-3.2.12/lib/active_model/validations.rb:179:in `dup'
from /Users/sikachu/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.12/lib/active_record/base.rb:562:in `dup'
from (irb):2
from /Users/sikachu/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/commands/console.rb:47:in `start'
from /Users/sikachu/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/commands/console.rb:8:in `start'
from /Users/sikachu/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.12/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
irb(main):003:0>
sure, give me a minute
Seems to be the same thing as #7291 It's merged in 3-2-stable but it has not been released yet
that would explain why i am not able to reproduce the error in the tests :smile:
Oh, good call. Since that was merged, I'm closing this. Thanks guys! :D
(Oh, and I'll make sure we get another 3.2.x RC soon. :smile:)
I just got this too. Rails 3.2.12 and Ruby 2.0.0-p0.
@njnorrgard please wait for 3.2.13 or point your Gemfile to 3-2-stable
for now.
Any idea when this will get released? Its the only thing in Rails that breaks for me with Ruby 2.0
this should do it: https://rubygems.org/gems/rails/versions/3.2.13.rc2
Yes, 3.2.13.rc2 is the version to use with 2.0, the final 3.2.13 should be released soon.
Works perfectly. Thanks!
This seems to be back again, using Ruby 2.1.0, Rails 4.0.2 . See StackOverflow
@jrep sorry, that question is something entirely unrelated - did you link to the wrong question or post in the wrong GH issue?
switching my rails 3.2.12 project to ruby 2.0.0 fails a test:
this is the code that gets called: https://github.com/phoet/on_ruby/blob/master/app/models/event.rb#L86
looks like
initialize_dup
is now a private method :sadpanda: