Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when trying to generate devise:install in Ruby on Rails

I'm a new to Ruby on Rails and I tried to do some examples from Internet. But I have an error when I'm trying to generate devise install. I modified the Gemfile by adding gem devise. Then run:

bundle install

but when I run.

rails generate devise:install

I had the next error:

/usr/local/lib/ruby/gems/0.9.1/gems/devise-1.1.3/lib/devise.rb:193:in `mailer=': undefined method `ref' for ActiveSupport::Dependencies:Module (NoMethodError)
    from /usr/local/lib/ruby/gems/1.9.1/gems/devise-1.1.3/lib/devise.rb:195:in `<module:Devise>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/devise-1.1.3/lib/devise.rb:4:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /home/mihai/Desktop/blog/config/application.rb:7:in `<top (required)>'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:24:in `require'
    from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:24:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Please help me!

like image 353
23ars Avatar asked May 07 '13 08:05

23ars


2 Answers

The version of Devise is rather old.

You can do:

bundle update devise

And then:

bundle install

This should upgrade the Devise gem.

like image 173
poseid Avatar answered Oct 11 '22 00:10

poseid


you can try to put this inside your Gemfile instead of just gem 'devise'

gem 'devise', github: 'ghiculescu/devise', branch: 'patch-2'

Re-run bundle install

and then you can do rails generate devise:install

like image 20
Exodus Reed Avatar answered Oct 10 '22 22:10

Exodus Reed