Ruby on rails 4 Rails 4.2.5和userstamp-与方法创建者冲突
Gemfile 用户模型Ruby on rails 4 Rails 4.2.5和userstamp-与方法创建者冲突,ruby-on-rails-4,model,stamp,Ruby On Rails 4,Model,Stamp,Gemfile 用户模型 gem 'rails', '~> 4.2', '>= 4.2.5' gem 'userstamp', :git => 'https://github.com/stricte/userstamp.git', :branch => 'rails4' 如何修复它?您需要按照中的建议自定义可口吃通话 应该是这样的: You tried to define an association named creator on the model User, b
gem 'rails', '~> 4.2', '>= 4.2.5'
gem 'userstamp', :git => 'https://github.com/stricte/userstamp.git', :branch => 'rails4'
如何修复它?您需要按照中的建议自定义可口吃通话 应该是这样的:
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)
问题是Active record正在创建一个名为creator的方法,而gem也在尝试这样做,因为这是默认行为。更改创建者属性应该足够了。但是您可以自定义所有这些选项。您需要按照中的建议自定义可口述通话 应该是这样的:
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)
问题是Active record正在创建一个名为creator的方法,而gem也在尝试这样做,因为这是默认行为。更改创建者属性应该足够了。但是您可以自定义所有这些选项。如果我在User model User.rb中添加此代码,我会得到以下错误:
未定义的方法充当#
类用户undefined method act_as_stampable'for#
class Useracts_as_stampable :stamper_class_name => :person,
:creator_attribute => :create_user,
:updater_attribute => :update_user,
:deleter_attribute => :delete_user