Giter Club home page Giter Club logo

userstamp's Issues

rails 6

It seems as though the author isn't updating this project anymore

Is there anyone with an actively maintained fork?

Userstamps not set when updating/creating children

Hello,

When one updates or creates children with complex forms using accept_nested_attributes_for, the userstamps don't get updated for the modified children.

I think instead of using a before and after filter in the Stampable module, you should use an alias_method_chain (e.g. base.alias_method_chain :create, :userstamps) as in Rails' Timestamp module.

This worked for me

Regards

Push latest version to rubygems

I tried using the version on rubygems and I was getting the error regarding "deprecation due to use of class_inheritable_accessor". Version 2.0.2 has that issue resolved.

userstamp and authlogic (and possible workarounds?)

I'm using Authlogic as it seems to be a popular and easy to implement authentication solution.

However, current_user is defined as a private method in the application_controller, or at least it's defined that way in the example and the Railscast.

Anyway, that seems to cause issues for userstamp. I suppose one way to fix this would be to make it a public method?

Also, another thing that seems to work is to do this:
def set_stamper
#User.stamper = self.current_user
User.stamper = current_user
end

in the userstamp.rb file.

Any thoughts on which solution is better or if there's another way superior to either of those?

Rails 4.1 support: "creator" method name conflict

This is ugly, but "creator" association should probably be renamed to support Rails 4.1 and up.

I'm getting the following error right after Rails 4.1 upgrade:

/Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activerecord-4.1.0/lib/active_record/associations/builder/association.rb:30:in `build': You tried to define an association named creator on the model User, but this will conflict with a method creator already defined by Active Record. Please choose a different association name. (ArgumentError)
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activerecord-4.1.0/lib/active_record/associations.rb:1421:in `belongs_to'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/bundler/gems/userstamp-777633aa564f/lib/userstamp/stampable.rb:82:in `block in stampable'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/bundler/gems/userstamp-777633aa564f/lib/userstamp/stampable.rb:81:in `class_eval'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/bundler/gems/userstamp-777633aa564f/lib/userstamp/stampable.rb:81:in `stampable'
    from /Users/alexk/dev/alkaline-morning/app/models/user.rb:8:in `<class:User>'
    from /Users/alexk/dev/alkaline-morning/app/models/user.rb:1:in `<top (required)>'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:443:in `load'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:443:in `block in load_file'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:633:in `new_constants_in'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:442:in `load_file'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:342:in `require_or_load'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:480:in `load_missing_constant'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:180:in `const_missing'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/inflector/methods.rb:238:in `const_get'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/inflector/methods.rb:238:in `block in constantize'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/inflector/methods.rb:236:in `each'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/inflector/methods.rb:236:in `inject'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/inflector/methods.rb:236:in `constantize'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:552:in `get'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:583:in `constantize'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/devise-3.2.4/lib/devise.rb:297:in `get'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/devise-3.2.4/lib/devise/mapping.rb:77:in `to'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/devise-3.2.4/lib/devise/mapping.rb:72:in `modules'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/devise-3.2.4/lib/devise/mapping.rb:89:in `routes'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/devise-3.2.4/lib/devise/mapping.rb:156:in `default_used_route'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/devise-3.2.4/lib/devise/mapping.rb:66:in `initialize'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/devise-3.2.4/lib/devise.rb:331:in `new'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/devise-3.2.4/lib/devise.rb:331:in `add_mapping'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/devise-3.2.4/lib/devise/rails/routes.rb:221:in `block in devise_for'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/devise-3.2.4/lib/devise/rails/routes.rb:220:in `each'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/devise-3.2.4/lib/devise/rails/routes.rb:220:in `devise_for'
    from /Users/alexk/dev/alkaline-morning/config/routes.rb:2:in `block in <top (required)>'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/actionpack-4.1.0/lib/action_dispatch/routing/route_set.rb:335:in `instance_exec'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/actionpack-4.1.0/lib/action_dispatch/routing/route_set.rb:335:in `eval_block'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/actionpack-4.1.0/lib/action_dispatch/routing/route_set.rb:313:in `draw'
    from /Users/alexk/dev/alkaline-morning/config/routes.rb:1:in `<top (required)>'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `block in load'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/application/routes_reloader.rb:40:in `each'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/application/routes_reloader.rb:40:in `load_paths'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/application/routes_reloader.rb:16:in `reload!'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/application/routes_reloader.rb:26:in `block in updater'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/file_update_checker.rb:75:in `call'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/file_update_checker.rb:75:in `execute'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/application/routes_reloader.rb:27:in `updater'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/application/finisher.rb:71:in `block in <module:Finisher>'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/initializable.rb:30:in `run'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/alexk/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
    from /Users/alexk/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
    from /Users/alexk/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
    from /Users/alexk/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
    from /Users/alexk/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each'
    from /Users/alexk/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `call'
    from /Users/alexk/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
    from /Users/alexk/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
    from /Users/alexk/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/application.rb:288:in `initialize!'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/railtie.rb:194:in `public_send'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/railtie.rb:194:in `method_missing'
    from /Users/alexk/dev/alkaline-morning/config/environment.rb:5:in `<top (required)>'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `block in require'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:247:in `require'
    from /Users/alexk/dev/alkaline-morning/config.ru:3:in `block in <main>'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
    from /Users/alexk/dev/alkaline-morning/config.ru:in `new'
    from /Users/alexk/dev/alkaline-morning/config.ru:in `<main>'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/commands/server.rb:50:in `app'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/commands/server.rb:130:in `log_to_stdout'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/commands/server.rb:67:in `start'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:81:in `block in server'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `tap'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `server'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /Users/alexk/.rvm/gems/ruby-2.1.2@am/gems/railties-4.1.0/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

This would require a major version bump and a ton of pain for everybody who uses it. :(

Warning of "class_inheritable_attribute is deprecated"

Hi,

I have upgraded rails 3.0 to rails 3.1.
When I use userstamp (gem "userstamp", "~> 2.0.1"), when use rails console, rails server, rake, etc, the deprecated warning emerged:


DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from  at /home/simon/rorworkspace/rails310/railsdemo/config/application.rb:13)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from  at /home/simon/rorworkspace/rails310/railsdemo/config/application.rb:13)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from  at /home/simon/rorworkspace/rails310/railsdemo/config/application.rb:13)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from  at /home/simon/rorworkspace/rails310/railsdemo/config/application.rb:13)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from  at /home/simon/rorworkspace/rails310/railsdemo/config/application.rb:13)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from  at /home/simon/rorworkspace/rails310/railsdemo/config/application.rb:13)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from  at /home/simon/rorworkspace/rails310/railsdemo/config/application.rb:13)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from  at /home/simon/rorworkspace/rails310/railsdemo/config/application.rb:13)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from  at /home/simon/rorworkspace/rails310/railsdemo/config/application.rb:13)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from  at /home/simon/rorworkspace/rails310/railsdemo/config/application.rb:13)

When I discarded userstamp gem in Gemfile, the warning disappeared.

Everything works OK with the warning message, but it confuse me every time.

Is any new version have fixed this warning?

Rails 3 compatibility

Probably not your top priority by any stretch of the imagination, but I'm currently getting this error under Rails 3.0.0-beta:

undefined local variable or method `stampable' for #Class:0x2793220 (NameError)

Thanks for the great library!

Rails 4.2.5 - conflict with a method creator

Gemfile

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

User model

class User < ActiveRecord::Base
  ...
  model_stamper
  stampable
  ...
end

I have this message

You tried to define an association named creator on the model User, but this will conflict with a method creator already defined by Active Record. Please choose a different association name. (ArgumentError)

How I can fix it?

Rails 4 not supported?

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

Issue with dynamic_matchers after gem install.

so i added userstamp to Gemfile, run bundler and then when i try to
rails g migration somename
i get:
/home/sarin/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.3/lib/active_record/dynamic_matchers.rb:50:in method_missing': undefined methodclass_inheritable_accessor' for ActiveRecord::Base:Class (NoMethodError)
from /home/sarin/.rvm/gems/ruby-1.9.3-p194/gems/userstamp-2.0.1/lib/stampable.rb:29:in block in included' from /home/sarin/.rvm/gems/ruby-1.9.3-p194/gems/userstamp-2.0.1/lib/stampable.rb:25:inclass_eval'
from /home/sarin/.rvm/gems/ruby-1.9.3-p194/gems/userstamp-2.0.1/lib/stampable.rb:25:in included' from /home/sarin/.rvm/gems/ruby-1.9.3-p194/gems/userstamp-2.0.1/lib/stampable.rb:154:ininclude'
from /home/sarin/.rvm/gems/ruby-1.9.3-p194/gems/userstamp-2.0.1/lib/stampable.rb:154:in <top (required)>' from /home/sarin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:inrequire'
from /home/sarin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in block in require' from /home/sarin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:inload_dependency'
from /home/sarin/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in require' from /home/sarin/.rvm/gems/ruby-1.9.3-p194/gems/userstamp-2.0.1/lib/userstamp.rb:2:in<top (required)>'
from /home/sarin/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in require' from /home/sarin/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:inblock (2 levels) in require'
from /home/sarin/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in each' from /home/sarin/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:inblock in require'
from /home/sarin/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in each' from /home/sarin/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:inrequire'
from /home/sarin/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.2.1/lib/bundler.rb:128:in require' from /home/sarin/projects/nau-pomocniczy/config/application.rb:13:in<top (required)>'
from /home/sarin/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands.rb:24:in require' from /home/sarin/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/lib/rails/commands.rb:24:in<top (required)>'
from script/rails:6:in require' from script/rails:6:in

'

Best changes from forked repos

Hey,

Since this plugin seems to be getting some attention again, I would suggest pulling in the changes from this repo:

https://github.com/insphire/userstamp

Specifically, the issues that are addressed that haven't been updated in this repo yet:

  • deleter option defined as a preference instead of looking for acts_as_paranoid
  • creator/updater ids set before_validation instead of on save (so that presence can be verified in validations)
  • a few issues related to class names

I can put in a pull request if it would help

before_filter to before_action for Rails 5

Please correct before_filter and after_filter on before_action and after_action for Rails 5

userstamp/lib/userstamp.rb

module Ddb
  module Controller
    ...
    module Userstamp
      def self.included(base) # :nodoc:
        base.send           :include, InstanceMethods
        base.before_filter  :set_stamper
        base.after_filter   :reset_stamper
      end
    end
   ...
  end
end

creator not set until after validation

Is there any reason why the stamper couldn't be set before validations?

I have a case where I want to ensure that a creator doesn't already have an object, but the creator id doesn't get set until after validations.

I changed stampable.rb to have
before_validation :set_updater_attribute
before_validation_on_create :set_creator_attribute

Is there a reason why this is a bad idea? (sorry if this covered in a google group already)

issue after bundle install

I put the gem into my rails application, typed in bundle install, restarted server and the server crashed, displayed in console:
There was an error while trying to load the gem 'userstamp'. (Bundler::GemRequireError) Gem Load Error is: undefined method class_inheritable_accessor for ActiveRecord::Base:Class Did you mean? class_variables

Why does AR::Base get made stampable?

Is there any reason that self.stampable is in Stampable::included? Because ActiveRecord::Base includes Stampable, it means that not only do the callbacks get added twice (once via AR:Base, a second time when calling stampable in the model), but also every single model gets associations and callbacks set up for it.

I've removed it locally but am I going to break anything I'm not seeing by doing so?

Migration helper not working with Rails 3.2.3

Migration helper 'userstamps' is not working in Rails 3.2.3, it seems that the t object in create_table and change_table in migration files pass object of ActiveRecord::ConnectionAdapters::TableDefinition type, But this was changed to ActiveRecord::ConnectionAdapters::Table in commit aee44af

using userstamps in existing schema

Hi,

Is it possible to use t.userstamps with change_table instead of create_table in migrations? I'd like to use this with an existing database and I can't get it to work that way, i keep getting this error:

undefined method `userstamps' for #ActiveRecord::ConnectionAdapters::Table:0x102e99f78

What am i doing wrong? How can i fix this?

thanks in advance,
_ miguel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.