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
If you generate scaffolding for admin/users some of the links in the views will be incorrect (missing the namespace). For example, the link to create a new user should look like new_admin_user_path but the generator has new_user_path.
Not all links are incorrect, but most are.
Cause
In the template some of the links are created like:
link_to edit_<%= singular_table_name %>_path(does not include namespace)
While others are created like:
link_to <%= index_helper %>_path(does include namespace)
Proposed Solution
Based on https://api.rubyonrails.org/classes/Rails/Generators/NamedBase.html; I think we can just use other helper methods, eg: show_helper & edit_helper in placed of singular_table_name. Tho, that will produce _url style links as opposed to _path style links like now.
I don't see any activity in a while, but if you haven't moved away from this project would you like a PR?
The text was updated successfully, but these errors were encountered:
jvanus
changed the title
Scaffolding does not respect namespace in routes
Scaffolding does not respect namespace in links
Nov 26, 2018
Problem
If you generate scaffolding for
admin/users
some of the links in the views will be incorrect (missing the namespace). For example, the link to create a new user should look likenew_admin_user_path
but the generator hasnew_user_path
.Not all links are incorrect, but most are.
Cause
In the template some of the links are created like:
link_to edit_<%= singular_table_name %>_path
(does not include namespace)While others are created like:
link_to <%= index_helper %>_path
(does include namespace)Proposed Solution
Based on https://api.rubyonrails.org/classes/Rails/Generators/NamedBase.html; I think we can just use other helper methods, eg:
show_helper
&edit_helper
in placed of singular_table_name. Tho, that will produce_url
style links as opposed to_path
style links like now.I don't see any activity in a while, but if you haven't moved away from this project would you like a PR?
The text was updated successfully, but these errors were encountered: