Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaffolding does not respect namespace in links #49

Open
jvanus opened this issue Nov 26, 2018 · 0 comments
Open

Scaffolding does not respect namespace in links #49

jvanus opened this issue Nov 26, 2018 · 0 comments

Comments

@jvanus
Copy link

jvanus commented 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 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?

@jvanus jvanus changed the title Scaffolding does not respect namespace in routes Scaffolding does not respect namespace in links Nov 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant