rails3 upgrade - You provided devise_for :users but there is no model User defined in your application

210 views
Skip to first unread message

robj

unread,
Sep 9, 2010, 10:51:12 PM9/9/10
to Devise
followed rails3 upgrade process as described in the railscast series,
using rails_upgrade

ruby 1.9.2 installed with RVM, Have tried both 1.2 from git , and
1.1.2 devise.
Loading the app without devise gives me

Exiting
script/rails:6: stack level too deep (SystemStackError)

raising the stack limit with ulimit doesn't help

any ideas on what may be wrong?

-----


Gemfile:


gem 'rails', '3.0.0'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'mysql2'

gem "warden"
gem "devise", '1.1.2'
#gem "devise", :git => "git://github.com/plataformatec/devise.git"

-----

routes.rb:

MyApp::Application.routes.draw do

resources :users

devise_for :users


-------

user.rb model:

devise :registerable, :authenticatable, :recoverable,
:rememberable, :trackable, :validatable



-------


trace as follows:

[WARNING] You provided devise_for :users but there is no model User
defined in your application
Exiting
/Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/activerecord-3.0.0/lib/
active_record/base.rb:1016:in `method_missing': undefined method
`devise' for #<Class:0x00000100acdc20> (NoMethodError)
from /Users/robert/dev/furtraxx/app/models/user.rb:26:in
`<class:User>'
from /Users/robert/dev/furtraxx/app/models/user.rb:1:in `<top
(required)>'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:454:in `load'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:454:in `block
in load_file'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:591:in
`new_constants_in'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:453:in
`load_file'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:340:in
`require_or_load'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:491:in
`load_missing_constant'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:183:in `block
in const_missing'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:181:in `each'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:181:in
`const_missing'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/inflector/methods.rb:124:in
`block in constantize'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/inflector/methods.rb:123:in
`each'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/inflector/methods.rb:123:in
`constantize'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:523:in `block
in <class:Reference>'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:533:in `yield'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:533:in
`default'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:533:in `get'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/devise-1.1.2/
lib/devise/mapping.rb:69:in `to'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/devise-1.1.2/
lib/devise/mapping.rb:64:in `modules'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/devise-1.1.2/
lib/devise/mapping.rb:73:in `strategies'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/devise-1.1.2/
lib/devise.rb:276:in `block in configure_warden!'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/devise-1.1.2/
lib/devise.rb:275:in `each_value'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/devise-1.1.2/
lib/devise.rb:275:in `configure_warden!'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/devise-1.1.2/
lib/devise/rails/routes.rb:7:in `finalize_with_devise!'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/
lib/rails/application.rb:128:in `block in reload_routes!'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/lazy_load_hooks.rb:36:in
`instance_eval'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/lazy_load_hooks.rb:36:in
`execute_hook'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/lazy_load_hooks.rb:26:in
`on_load'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/
lib/rails/application.rb:128:in `reload_routes!'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/
lib/rails/application.rb:120:in `block in routes_reloader'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/file_update_checker.rb:32:in
`call'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/file_update_checker.rb:32:in
`execute_if_updated'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
actionpack-3.0.0/lib/action_dispatch/railtie.rb:14:in `block (2
levels) in <class:Railtie>'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/callbacks.rb:419:in
`_run_prepare_callbacks'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
actionpack-3.0.0/lib/action_dispatch/middleware/callbacks.rb:40:in
`initialize'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
actionpack-3.0.0/lib/action_dispatch/middleware/stack.rb:33:in `new'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
actionpack-3.0.0/lib/action_dispatch/middleware/stack.rb:33:in `build'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
actionpack-3.0.0/lib/action_dispatch/middleware/stack.rb:79:in `block
in build'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
actionpack-3.0.0/lib/action_dispatch/middleware/stack.rb:79:in `each'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
actionpack-3.0.0/lib/action_dispatch/middleware/stack.rb:79:in
`inject'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
actionpack-3.0.0/lib/action_dispatch/middleware/stack.rb:79:in `build'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/
lib/rails/application.rb:162:in `app'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/
lib/rails/application/finisher.rb:35:in `block in <module:Finisher>'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/
lib/rails/initializable.rb:25:in `instance_exec'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/
lib/rails/initializable.rb:25:in `run'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/
lib/rails/initializable.rb:50:in `block in run_initializers'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/
lib/rails/initializable.rb:49:in `each'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/
lib/rails/initializable.rb:49:in `run_initializers'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/
lib/rails/application.rb:134:in `initialize!'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/
lib/rails/application.rb:77:in `method_missing'
from /Users/robert/dev/furtraxx/config/environment.rb:5:in
`<top (required)>'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block
in require'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `block
in load_dependency'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:591:in
`new_constants_in'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:225:in
`load_dependency'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/
activesupport-3.0.0/lib/active_support/dependencies.rb:239:in
`require'
from /Users/robert/dev/furtraxx/config.ru:3:in `block in
<main>'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/
rack/builder.rb:46:in `instance_eval'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/
rack/builder.rb:46:in `initialize'
from /Users/robert/dev/furtraxx/config.ru:1:in `new'
from /Users/robert/dev/furtraxx/config.ru:1:in `<main>'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/
rack/builder.rb:35:in `eval'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/
rack/builder.rb:35:in `parse_file'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/
rack/server.rb:162:in `app'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/
rack/server.rb:248:in `wrapped_app'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/
rack/server.rb:213:in `start'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/
lib/rails/commands/server.rb:65:in `start'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/
lib/rails/commands.rb:30:in `block in <top (required)>'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/
lib/rails/commands.rb:27:in `tap'
from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.0/
lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

Alex Ewetumo

unread,
Sep 10, 2010, 6:14:37 AM9/10/10
to plataforma...@googlegroups.com
i tend to just put gem 'devise' in the bundle gemfile...so try that without the version number ,plus hope your ran : rails g devise User ....to ensure the model was created plus it might be a bugg in the edged version of bundle or rails

ignu

unread,
Sep 11, 2010, 7:25:16 PM9/11/10
to Devise
i'm getting this error too trying to upgrade a rails 2 app.
> ...
>
> read more »

radhames brito

unread,
Sep 11, 2010, 11:11:57 PM9/11/10
to plataforma...@googlegroups.com
oh i had this problem and solve it but i dont remember how, as soon as i remember ill let you know

robj

unread,
Sep 12, 2010, 3:36:51 PM9/12/10
to Devise
The problem ended being the ORM needs to be explicitly required in the
devise initaliser ... I was under the impression this did not have to
be set, (as in devise1.0.x/rails2) as the initializer comments state
active record is default.

# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default)
...

require 'devise/orm/active_record'


My only issue now being (even after changing the devise initalizer
cryptor to sha1) my logins for old users are failing, new users are
fine. This is not the end of the world as my app is yet to go into
production, but im unsure why they fail.
> > > >        from /Users/robert/.rvm/gems/ruby-1.9.2-p0/gems/...
>
> read more »

radhames brito

unread,
Sep 12, 2010, 9:30:22 PM9/12/10
to plataforma...@googlegroups.com
im going to mark this since this could be useful in the future
Reply all
Reply to author
Forward
0 new messages