Reputation: 2319
I am having issues getting Rails Admin to play nice with Heroku. I am getting a routing error when an admin is logged in, here is the error:
No route matches {:controller=>"rails_admin/main"}
I believe this error occurs because of this code in my application.html.erb
:
<% if current_admin %>
<%= link_to "Admin Dashboard", rails_admin.index_path %>
<% end %>
It seems to occur when I call the rails_admin.index_path
in the link_to
. However if I go to myurl/admin
it lets me see the admin dashboard fine. Also everything works fine in my development and production environment locally.
Output of rake routes
:
rails_admin /admin RailsAdmin::Engine
users_index GET /users/index(.:format) users#index
users_show GET /users/show(.:format) users#show
/user/:id(.:format) users#show
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
welcome_index GET /welcome/index(.:format) welcome#index
songs GET /songs(.:format) songs#index
POST /songs(.:format) songs#create
new_song GET /songs/new(.:format) songs#new
edit_song GET /songs/:id/edit(.:format) songs#edit
song GET /songs/:id(.:format) songs#show
PUT /songs/:id(.:format) songs#update
DELETE /songs/:id(.:format) songs#destroy
root / welcome#index
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
Upvotes: 0
Views: 1956
Reputation: 2319
The solution for me was to change
rails_admin.index_path
to
rails_admin.dashboard_path
Don't know why it doesn't work the other way around in production but this will do.
Upvotes: 1