thoughtbot/upcase

Problem while loading admin path

tannakartikey opened this issue · 1 comments

Below is the error I am getting.

Does it mean that rails_admin is not being loaded?

NameError in RailsAdmin::Main#dashboard

Showing /home/username/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails_admin-1.2.0/app/views/rails_admin/main/dashboard.html.haml where line #30 raised:

undefined local variable or method `rails_admin' for #<#<Class:0x007f1361031b70>:0x007f13614972a0>
Did you mean?  rails_admin_form_for

rake routes show the following RailsAdmin routes.

Routes for RailsAdmin::Engine:
    dashboard GET         /                                      rails_admin/main#dashboard
        index GET|POST    /:model_name(.:format)                 rails_admin/main#index
          new GET|POST    /:model_name/new(.:format)             rails_admin/main#new
       export GET|POST    /:model_name/export(.:format)          rails_admin/main#export
  bulk_delete POST|DELETE /:model_name/bulk_delete(.:format)     rails_admin/main#bulk_delete
history_index GET         /:model_name/history(.:format)         rails_admin/main#history_index
  bulk_action POST        /:model_name/bulk_action(.:format)     rails_admin/main#bulk_action
         show GET         /:model_name/:id(.:format)             rails_admin/main#show
         edit GET|PUT     /:model_name/:id/edit(.:format)        rails_admin/main#edit
       delete GET|DELETE  /:model_name/:id/delete(.:format)      rails_admin/main#delete
 history_show GET         /:model_name/:id/history(.:format)     rails_admin/main#history_show
  show_in_app GET         /:model_name/:id/show_in_app(.:format) rails_admin/main#show_in_app

app.rails_admin show the following errors:

(development) main:0> app.rails_admin
NoMethodError: undefined method `rails_admin' for #<ActionDispatch::Integration::Session:0x005636414f7f68>
Did you mean?  rails_info_path
from /home/kartikey/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-4.2.10/lib/action_dispatch/testing/assertions/routing.rb:171:in `method_missing'

Before this error I got the following error:

ActiveRecord::StatementInvalid in RailsAdmin::MainController#dashboard
PG::SyntaxError: ERROR: zero-length delimited identifier at or near """" LINE 1: ...ROM "latest_attempts" ORDER BY "latest_attempts"."" DESC LI... ^ : SELECT "latest_attempts".* FROM "latest_attempts" ORDER BY "latest_attempts"."" DESC LIMIT 1

Which I fixed by adding the following lines in app/models/latest_attempts.rb

  self.primary_key = :user_id
  self.primary_key = :flashcard_id

Resolved with #1762