Reputation: 552
I have added the gem 'devise' to my Gemfile. Everything installs fine, but when I run rails generate devise:install, I get this error.
jshuadvd:estuk joshuadavid$ bundle show devise
/Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/devise-3.4.1
jshuadvd:estuk joshuadavid$ rails generate devise:install
/Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activerecord-4.1.1/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined method `devise' for Install (call 'Install.connection' to establish a connection):Class (NoMethodError)
from /Users/joshuadavid/stukwork/estuk/app/models/install.rb:4:in `<class:Install>'
from /Users/joshuadavid/stukwork/estuk/app/models/install.rb:1:in `<top (required)>'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:443:in `load'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:443:in `block in load_file'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:633:in `new_constants_in'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:442:in `load_file'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:342:in `require_or_load'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:480:in `load_missing_constant'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:180:in `const_missing'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:238:in `const_get'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:238:in `block in constantize'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:236:in `each'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:236:in `inject'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/inflector/methods.rb:236:in `constantize'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:552:in `get'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:583:in `constantize'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/devise-3.4.1/lib/devise.rb:302:in `get'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/devise-3.4.1/lib/devise/mapping.rb:80:in `to'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/devise-3.4.1/lib/devise/mapping.rb:75:in `modules'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/devise-3.4.1/lib/devise/mapping.rb:92:in `routes'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/devise-3.4.1/lib/devise/mapping.rb:159:in `default_used_route'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/devise-3.4.1/lib/devise/mapping.rb:69:in `initialize'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/devise-3.4.1/lib/devise.rb:336:in `new'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/devise-3.4.1/lib/devise.rb:336:in `add_mapping'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/devise-3.4.1/lib/devise/rails/routes.rb:224:in `block in devise_for'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/devise-3.4.1/lib/devise/rails/routes.rb:223:in `each'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/devise-3.4.1/lib/devise/rails/routes.rb:223:in `devise_for'
from /Users/joshuadavid/stukwork/estuk/config/routes.rb:2:in `block in <top (required)>'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:335:in `instance_exec'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:335:in `eval_block'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:313:in `draw'
from /Users/joshuadavid/stukwork/estuk/config/routes.rb:1:in `<top (required)>'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `load'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `block in load'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `load'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:40:in `each'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/file_update_checker.rb:75:in `call'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/file_update_checker.rb:75:in `execute'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:27:in `updater'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/finisher.rb:71:in `block in <module:Finisher>'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `run'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/joshuadavid/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /Users/joshuadavid/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /Users/joshuadavid/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /Users/joshuadavid/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /Users/joshuadavid/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /Users/joshuadavid/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /Users/joshuadavid/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /Users/joshuadavid/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /Users/joshuadavid/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application.rb:288:in `initialize!'
from /Users/joshuadavid/stukwork/estuk/config/environment.rb:5:in `<top (required)>'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/spring-1.3.3/lib/spring/application.rb:92:in `preload'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/spring-1.3.3/lib/spring/application.rb:143:in `serve'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/spring-1.3.3/lib/spring/application.rb:131:in `block in run'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/spring-1.3.3/lib/spring/application.rb:125:in `loop'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/spring-1.3.3/lib/spring/application.rb:125:in `run'
from /Users/joshuadavid/.rvm/gems/ruby-2.1.2/gems/spring-1.3.3/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/joshuadavid/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/joshuadavid/.rvm/rubies/ruby-2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
jshuadvd:estuk joshuadavid$
Here is my config/application.rb for review
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Estuk
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
end
If you need anything else, please don't hesitate to ask. Thanks!
Upvotes: 1
Views: 341
Reputation: 1113
Ok, I managed to reproduce the problem. He ran rails generate devise install
without the colon. Which generated a model and a route entry for 'Install'. You can see the model being used in the stack trace.
To fix this delete this file: /Users/joshuadavid/stukwork/estuk/app/models/install.rb
Then open up your routes (config/routes.rb) and delete the line on the top that says 'devise_for Install'. Save the file and run the install generator again, this time make sure to use the correct version: rails generate devise:install
Upvotes: 2
Reputation: 614
To make sure this question is fully answered, you can add several lines of code in couple of lines.
First, you install devise with
gem 'devise'
into your own Gemfile and run bundle update
.
Then afterwards, finalize the install with
rails g devise:install
Lastly, add Devise into config/application.rb:
...
require 'Devise'
require 'rails/all'
...
That's should work with your project successfully. I hope you are having a lot of fun with Rails. Best wishes.
Upvotes: 0