的Gemfile
gem 'rails', '~> 4.2', '>= 4.2.5'
gem 'userstamp', :git => 'https://github.com/stricte/userstamp.git', :branch => 'rails4'
用户模型
class User < ActiveRecord::Base
...
model_stamper
stampable
...
end
我有这条消息
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)
我该如何解决?
答案 0 :(得分:0)
您需要按照docs。
中的建议自定义您的可压印通话应该是这样的:
acts_as_stampable :stamper_class_name => :person,
:creator_attribute => :create_user,
:updater_attribute => :update_user,
:deleter_attribute => :delete_user
问题是Active记录正在创建一个名为creator的方法,而gem正在尝试这样做,因为这是默认行为。更改创建者属性应该足够了。但是你有自定义的所有选项。