Question

I followed the steps to get friendly_id working in the rails engine - which are posted here on github and it seems that when I do the following:

  s.add_dependency 'friendly_id', '~> 5.0.0'

in the engine.gemspec file and then do:

bundle install #=> works
rails g friendly_id #=> works
rake db:migrate

I get:

rake aborted!
uninitialized constant FriendlyId

Um .... What?

Update - Modal with FriendlyId

  module Xaaron
     class Role < ActiveRecord::Base
        extend FriendlyId
        friendly_id :role, use: :slugged

        validates :role, presence: true
        validates_uniqueness_of :role
      end
   end
Was it helpful?

Solution

You may need to explicitly require FriendlyId from your engine (docs):

require 'friendly_id'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top