In my app, my associations are set up so each User can have many Equipments, and each Equipment belongs to one User.
When running administrate, going to the admin index page which is admin/users it comes up with the following error:
ActionController::UrlGenerationError in Admin::Equipment#index
No route matches {:action=>"show", :controller=>"admin/equipment"} missing required keys: [:id]
Same error occurs on admin/equipment route
I am able to get to admin/users/1, which shows the associated user and its equipments, although in the sidebar i notice the link for Equipment is http://localhost:3000/admin/equipment/1
This link works to show the first equipment object, but Shouldn't that be just admin/equipment?
and why isn't my admin_equipment_index action working with equipment/index it looks like its using equipment/show?
See routes below
Having the same issue on a model named 'PatientData' probably its because of pluralization.
Looks to be the same as #393 and #378
I submitted a PR for this: https://github.com/thoughtbot/administrate/pull/414
Just hit this with a model named "Series"
Same here, same model 'Equipment'.
Same as @pablo-co on model Equipment
Work around.
I already was using a custom layout e.g. rails g administrate:views:layout so in app/views/admin/application/_sidebar.html.erb I made the following mod which is based off of @tmecklem pr #414
<%#
# Sidebar
This partial is used to display the sidebar in Administrate.
By default, the sidebar contains navigation links
for all resources in the admin dashboard,
as defined by the DashboardManifest.
%>
<ul class="sidebar__list">
<% DashboardManifest::DASHBOARDS.each do |resource| %>
<li>
<%= link_to(
display_resource_name(resource),
[namespace, resource == :equipment ? ActiveModel::Naming.route_key(resource.to_s.classify.constantize) : resource],
class: "sidebar__link sidebar__link--#{nav_link_state(resource)}"
) %>
</li>
<% end %>
</ul>
The line that is changed:
[namespace, resource == :equipment ? ActiveModel::Naming.route_key(resource.to_s.classify.constantize) : resource],
I haven't heard anything about PR #414. It seems like the fix is still valid and needed. @graysonwright can I get an up or down on that PR for this issue?
Upgrading to 0.7.0 broke this fix for me. I got around it by modifying this workaround slightly like so:
[namespace, resource.to_s == 'series' ? ActiveModel::Naming.route_key(resource.to_s.classify.constantize) : resource.path],
Just hit it today. Seems like this bug is still active.
The fix (#934) isn't actually in a release yet, as it went out just after v0.8.1. It should be in soon, but in the meantime, I would recommend installing from GitHub directly.
I'm going to close this for now, but please open a new issue if it's still occurring when you do that.
Most helpful comment
Just hit this with a model named "Series"