Skip to content

Commit

Permalink
Improve error message on undefined method devise.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Feb 25, 2010
1 parent 94511c1 commit 484361e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/devise/rails/routes.rb
Expand Up @@ -93,6 +93,12 @@ def devise_for(*resources)
resources.each do |resource|
mapping = Devise::Mapping.new(resource, options.dup)

unless mapping.to.respond_to?(:devise)
raise "#{mapping.to.name} does not respond to 'devise' method. This usually means you haven't " <<
"loaded your ORM file or it's being loaded to late. To fix it, be sure to require 'devise/orm/YOUR_ORM' " <<
"inside 'config/initializers/devise.rb' or before your application definition in 'config/application.rb'"
end

Devise.default_scope ||= mapping.name
Devise.mappings[mapping.name] = mapping

Expand Down

0 comments on commit 484361e

Please sign in to comment.