Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 4 not supported? #22

Open
nir0 opened this issue Aug 13, 2013 · 6 comments
Open

Rails 4 not supported? #22

nir0 opened this issue Aug 13, 2013 · 6 comments

Comments

@nir0
Copy link

nir0 commented Aug 13, 2013

running tests now causes:

11:21:16 - INFO - Run all
11:21:16 - INFO - Running all specs
/home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/activerecord-4.0.0/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `class_inheritable_accessor' for ActiveRecord::Base:Class (NoMethodError)
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/userstamp-2.0.1/lib/stampable.rb:29:in `block in included'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/userstamp-2.0.1/lib/stampable.rb:25:in `class_eval'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/userstamp-2.0.1/lib/stampable.rb:25:in `included'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/userstamp-2.0.1/lib/stampable.rb:154:in `include'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/userstamp-2.0.1/lib/stampable.rb:154:in `<top (required)>'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/userstamp-2.0.1/lib/userstamp.rb:2:in `<top (required)>'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /home/nir0/projects/vsluh4/config/application.rb:7:in `<top (required)>'
    from /home/nir0/projects/vsluh4/config/environment.rb:2:in `require'
    from /home/nir0/projects/vsluh4/config/environment.rb:2:in `<top (required)>'
    from /home/nir0/projects/vsluh4/spec/spec_helper.rb:3:in `require'
    from /home/nir0/projects/vsluh4/spec/spec_helper.rb:3:in `<top (required)>'
    from /home/nir0/projects/vsluh4/spec/models/post_spec.rb:1:in `require'
    from /home/nir0/projects/vsluh4/spec/models/post_spec.rb:1:in `<top (required)>'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/rspec-core-2.14.4/lib/rspec/core/configuration.rb:896:in `load'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/rspec-core-2.14.4/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/rspec-core-2.14.4/lib/rspec/core/configuration.rb:896:in `each'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/rspec-core-2.14.4/lib/rspec/core/configuration.rb:896:in `load_spec_files'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/rspec-core-2.14.4/lib/rspec/core/command_line.rb:22:in `run'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/rspec-core-2.14.4/lib/rspec/core/runner.rb:80:in `run'
    from /home/nir0/.rvm/gems/ruby-2.0.0-p195@vsluh4dev/gems/rspec-core-2.14.4/lib/rspec/core/runner.rb:17:in `block in autorun'

appears when model_stamper is added into user model

@nir0
Copy link
Author

nir0 commented Aug 13, 2013

solved with

gem 'userstamp', :git => '[email protected]:kimkong/userstamp.git'

@vinhboy
Copy link

vinhboy commented Sep 13, 2014

Thanks for the tip. This worked for my Rails 4.1.5

@sunil1293
Copy link

raising ArgumentError by using stampable in any model

/[email protected]/gems/activerecord-4.1.5/lib/active_record/associations/builder/association.rb:30:
in `build': You tried to define an association named creator on the model < any model name >, but this will conflict with a method creator already defined by Active Record. Please choose a different association name. (ArgumentError)

@andrezimpel
Copy link

+1

@stricte
Copy link

stricte commented Jan 18, 2015

If anybody have problem with association name conflict in Rails 4 use this:

gem 'userstamp', :git => 'https://github.com/stricte/userstamp.git', :branch => 'rails4'

and configure custom associations names with (see last three lines):

stampable :stamper_class_name => :person,
:creator_attribute  => :created_by_person,
:updater_attribute  => :updated_by_person,
:deleter_attribute  => :deleted_by_person,
:creator_association => :person_creator,
:updater_association => :person_updater,
:deleter_association => :person_deleter

I have pushed this few minutes ago, so please test before use at production

@heberuriegas
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants