Undefined local variable or method 'rolify'

If you are using rolify gem

maybe you added rolify to your Gemfile like this this:

source 'https://rubygems.org'

gem 'rolify', '~> 5.1.0'  

Then you created your Role model and migration file using this generator:

$ rails g rolify Role User

Then you had run migrations:

$ rake db:migrate

Then if you go to your User model you have had seen something like:

class User < ActiveRecord::Base  


After that, you try to reload your browser then you experimented this error:

Undefined local variable or method 'rolify'

Guess what?

Restart rails server then you have fixed it!


Victor Velazquez

Coder, Musician, Startups, Passionate Dancer & Life Lover. Director of Engineering at MagmaLabs, Co-founder of Web Dev Talks, Co-founder of Voltaire, Co-founder of Paqkit, Ex-co-founder of Zaznova.

Subscribe to The zazvick's blog

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!