You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've a User model generated with devise_token_auth:install generator and there is a Staff model generated using rails generate devise Staff. Then I installed rails_admin and configured it to use the Staff model:
Showing /home/axl/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rails_admin-0.8.1/app/views/layouts/rails_admin/_secondary_navigation.html.haml where line #6 raised:
undefined method `tokens' for #<Staff:0x007ffb7a07f418>
Extracted source (around line #433):
431 else
432 match = match_attribute_method?(method.to_s)
433 match ? attribute_missing(match, *args, &block) : super
434 end
435
436
Trace of template inclusion: /home/axl/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rails_admin-0.8.1/app/views/layouts/rails_admin/_navigation.html.haml, /home/axl/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rails_admin-0.8.1/app/views/layouts/rails_admin/application.html.haml
Rails.root: /home/axl/coding/lyra-server
If I remove the block from ~/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rails_admin-0.8.1/app/views/layouts/rails_admin/_secondary_navigation.html.haml:6, then, the application doesn't break at all and the admin is shown as expected. I have no idea why.
Using byebug I found that implementing a token method for the Staff model also solves the problem.
deftokens{'default'=>'so not a nil value'}end
I think devise_token_auth shouldn't be executed at all in this scenario. Staff doesn't use it.
/app/controllers/devise_token_auth/concerns/set_user_by_token.rb:87 This method used for updating user tokens. If you actions use @resource variable it will raise such kind of exception.
I've a
User
model generated withdevise_token_auth:install
generator and there is aStaff
model generated usingrails generate devise Staff
. Then I installedrails_admin
and configured it to use the Staff model:On sign in, the application breaks with the error
If I remove the block from
~/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rails_admin-0.8.1/app/views/layouts/rails_admin/_secondary_navigation.html.haml:6
, then, the application doesn't break at all and the admin is shown as expected. I have no idea why.Using byebug I found that implementing a
token
method for theStaff
model also solves the problem.I think
devise_token_auth
shouldn't be executed at all in this scenario.Staff
doesn't use it.This is the full trace
The text was updated successfully, but these errors were encountered: