我按照步骤让rails_id在rails引擎中工作 – 发布了
here on github,似乎当我执行以下操作时:
s.add_dependency 'friendly_id','~> 5.0.0'
在engine.gemspec文件中然后执行:@H_404_5@
bundle install #=> works rails g friendly_id #=> works rake db:migrate
我明白了:@H_404_5@
rake aborted! uninitialized constant FriendlyId
嗯什么?@H_404_5@
更新 – 使用FriendlyId的模态@H_404_5@
module Xaaron class Role < ActiveRecord::Base extend FriendlyId friendly_id :role,use: :slugged validates :role,presence: true validates_uniqueness_of :role end end
解决方法
您可能需要从引擎中明确要求FriendlyId(
docs):
require 'friendly_id'