Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NameError: uninitialized constant with FriendlyId after migration to Rails4

I just migrated to Rails4 from 3.12 and I use FriendlyId, which was working fine in Rails 3.12 I followed the instructions I found here http://richonrails.com/articles/friendlyid-and-rails-4#.U6fTOY1_v_4

so my gemfile features:

gem 'friendly_id', '~> 5.0.0'

Using friendly_id 5.0.4

But I keep getting the following error message:

NameError: uninitialized constant <Classname>::FriendlyId

for each Class that resorts to FriendlyId

I saw this NameError in SongsController#index uninitialized constant Song::FriendlyId But in my case, bundle install doesn't change anything

like image 994
cedric Avatar asked Jan 28 '26 05:01

cedric


2 Answers

I had this same problem with Rails 4 - and I fixed it by restarting spring:

$ spring stop

I ran the console again and it went back to working.

like image 91
Chris O'Sullivan Avatar answered Jan 30 '26 23:01

Chris O'Sullivan


make sure you restart the console after bundling.


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!