userstamp icon indicating copy to clipboard operation
userstamp copied to clipboard

Rails 4 not supported?

Open nir0 opened this issue 11 years ago • 6 comments

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 avatar Aug 13 '13 05:08 nir0

solved with

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

nir0 avatar Aug 13 '13 05:08 nir0

Thanks for the tip. This worked for my Rails 4.1.5

vinhboy avatar Sep 13 '14 01:09 vinhboy

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)

sunil1293 avatar Sep 26 '14 11:09 sunil1293

+1

andrezimpel avatar Oct 31 '14 14:10 andrezimpel

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

stricte avatar Jan 18 '15 20:01 stricte

+1

heberuriegas avatar Mar 10 '15 17:03 heberuriegas