Skip to content

Getting NoMethodError: undefined method `stamper' on Rails 5.1.2 #22

@blimey85

Description

@blimey85

Running Rails 5.1.2 on Ruby 2.4.1 and getting this:

rails aborted!
StandardError: An error has occurred, all later migrations canceled:

undefined method `stamper' for #<Class:0x007fddce0423c0>
Did you mean?  stamper_class
/Users/gary/.rbenv/versions/2.4.1/gemsets/dp/gems/activerecord-5.1.2/lib/active_record/dynamic_matchers.rb:22:in `method_missing'
/Users/gary/.rbenv/versions/2.4.1/gemsets/dp/bundler/gems/activerecord-userstamp-871d822ffda4/lib/active_record/userstamp/stampable.rb:95:in `has_stamper?'
/Users/gary/.rbenv/versions/2.4.1/gemsets/dp/bundler/gems/activerecord-userstamp-871d822ffda4/lib/active_record/userstamp/stampable.rb:109:in `set_updater_attribute'
/Users/gary/.rbenv/versions/2.4.1/gemsets/dp/gems/activesupport-5.1.2/lib/active_support/callbacks.rb:413:in `block in make_lambda'

I thought this might be related to the initializer but I commented that out and get the same thing. This is using the master branch of the gem. Without specifying that I was pulling version 2.1.1 which appears to be very old.

I couldn't run tests on 2.4.1 but I figured running them on 2.4.0 would be sufficient. I'm using rbenv and my copy of 2.4.1 is just for my project... I do test stuff in 2.4.0. Anyway, here's the output of RSpec:

 ~/.r/v/2/g/d/b/g/activerecord-userstamp-871d822ffda4   master ±  rspec
-- create_table(:users, {:force=>true})
   -> 0.0192s
-- create_table(:people, {:force=>true})
   -> 0.0003s
-- create_table(:posts, {:force=>true})
   -> 0.0003s
-- create_table(:comments, {:force=>true})
   -> 0.0004s
-- create_table(:tags, {:force=>true})
   -> 0.0003s
-- create_table(:post_tags, {:force=>true})
   -> 0.0003s
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Randomized with seed 557
.FF.......FF......./Users/gary/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activerecord-5.1.2/lib/active_record/associations/builder/singular_association.rb:17: warning: method redefined; discarding old reload_creator
/Users/gary/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activerecord-5.1.2/lib/active_record/associations/builder/singular_association.rb:17: warning: previous definition of reload_creator was here
/Users/gary/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activerecord-5.1.2/lib/active_record/associations/builder/singular_association.rb:17: warning: method redefined; discarding old reload_updater
/Users/gary/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activerecord-5.1.2/lib/active_record/associations/builder/singular_association.rb:17: warning: previous definition of reload_updater was here
/Users/gary/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activerecord-5.1.2/lib/active_record/associations/builder/singular_association.rb:17: warning: method redefined; discarding old reload_deleter
/Users/gary/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activerecord-5.1.2/lib/active_record/associations/builder/singular_association.rb:17: warning: previous definition of reload_deleter was here
.F...................

Failures:

  1) UsersController when updating a User sets the correct updater
     Failure/Error: patch :update, id: @hera.id, user: { name: 'Different'}

     ArgumentError:
       unknown keywords: id, user
     # ./spec/controllers/users_controller_spec.rb:10:in `block (3 levels) in <top (required)>'

  2) UsersController when handling multiple requests sets the correct updater
     Failure/Error: get :edit, id: @hera.id

     ArgumentError:
       unknown keyword: id
     # ./spec/controllers/users_controller_spec.rb:31:in `block (3 levels) in <top (required)>'

  3) PostsController when handling multiple requests sets the correct updater
     Failure/Error: get :edit, id: @first_post.id

     ArgumentError:
       unknown keyword: id
     # ./spec/controllers/posts_controller_spec.rb:33:in `block (3 levels) in <top (required)>'

  4) PostsController when updating a Post sets the correct updater
     Failure/Error: post :update, id: @first_post.id, post: { title: 'Different' }

     ArgumentError:
       unknown keywords: id, post
     # ./spec/controllers/posts_controller_spec.rb:12:in `block (3 levels) in <top (required)>'

  5) ActiveRecord::Userstamp has a VERSION
     Failure/Error: expect(ActiveRecord::Userstamp::VERSION).to match(/^\d+\.\d+\.\d+$/)

     NameError:
       uninitialized constant ActiveRecord::Userstamp::VERSION
     # ./spec/lib/userstamp_spec.rb:5:in `block (2 levels) in <top (required)>'

Finished in 0.41237 seconds (files took 1.2 seconds to load)
40 examples, 5 failures

Failed examples:

rspec ./spec/controllers/users_controller_spec.rb:8 # UsersController when updating a User sets the correct updater
rspec ./spec/controllers/users_controller_spec.rb:29 # UsersController when handling multiple requests sets the correct updater
rspec ./spec/controllers/posts_controller_spec.rb:31 # PostsController when handling multiple requests sets the correct updater
rspec ./spec/controllers/posts_controller_spec.rb:10 # PostsController when updating a Post sets the correct updater
rspec ./spec/lib/userstamp_spec.rb:4 # ActiveRecord::Userstamp has a VERSION

Randomized with seed 557

Let me know how I can help on this. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions