ruby on rails - Devise class constantize -
i have versioned api using devise authentication, added following route , error below.
how can devise resolve constant api::v1::user rather apiv1user?
devise_for :api_v1_users
error message:
/users/danielcrompton/.rvm/rubies/ruby-1.9.3-p448/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=argv.shift) /users/danielcrompton/.rvm/gems/ruby-1.9.3-p448/bin/rake default testing started @ 11:25 ... /users/danielcrompton/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.14/lib/active_support/inflector/methods.rb:230:in `block in constantize': uninitialized constant apiv1user (nameerror) /users/danielcrompton/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.14/lib/active_support/inflector/methods.rb:229:in `each' /users/danielcrompton/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.14/lib/active_support/inflector/methods.rb:229:in `constantize' /users/danielcrompton/.rvm/gems/ruby-1.9.3-p448/gems/devise-3.1.0/lib/devise.rb:285:in `get' /users/danielcrompton/.rvm/gems/ruby-1.9.3-p448/gems/devise-3.1.0/lib/devise/mapping.rb:77:in `to' /users/danielcrompton/.rvm/gems/ruby-1.9.3-p448/gems/devise-3.1.0/lib/devise/mapping.rb:72:in `modules' /users/danielcrompton/.rvm/gems/ruby-1.9.3-p448/gems/devise-3.1.0/lib/devise/mapping.rb:89:in `routes' /users/danielcrompton/.rvm/gems/ruby-1.9.3-p448/gems/devise-3.1.0/lib/devise/mapping.rb:156:in `default_used_route' /users/danielcrompton/.rvm/gems/ruby-1.9.3-p448/gems/devise-3.1.0/lib/devise/mapping.rb:66:in `initialize' /users/danielcrompton/.rvm/gems/ruby-1.9.3-p448/gems/devise-3.1.0/lib/devise.rb:319:in `new' /users/danielcrompton/.rvm/gems/ruby-1.9.3-p448/gems/devise-3.1.0/lib/devise.rb:319:in `add_mapping' /users/danielcrompton/.rvm/gems/ruby-1.9.3-p448/gems/devise-3.1.0/lib/devise/rails/routes.rb:210:in `block in devise_for' /users/danielcrompton/.rvm/gems/ruby-1.9.3-p448/gems/devise-3.1.0/lib/devise/rails/routes.rb:209:in `each' /users/danielcrompton/.rvm/gems/ruby-1.9.3-p448/gems/devise-3.1.0/lib/devise/rails/routes.rb:209:in `devise_for' /**removed**/config/routes.rb:5:in `block (3 levels) in <top (required)>'
...
do this:
devise_for :api_v1_users, class_name: 'api::v1::user'
Comments
Post a Comment