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

DashboardGenerator does not update routes #720

Closed
mcmire opened this issue Dec 27, 2016 · 5 comments
Closed

DashboardGenerator does not update routes #720

mcmire opened this issue Dec 27, 2016 · 5 comments
Labels
feature new functionality that’s not yet implemented install initial setup, first-run experience, generators

Comments

@mcmire
Copy link

mcmire commented Dec 27, 2016

Apologies if someone else has already submitted this.

If you use rails g administrate:dashboard to create a new dashboard file, the new dashboard is not added to config/routes.rb, and thus it does not appear automatically in the sidebar. I realize this is probably on purpose; after all, how is the generator going to know where in the routes file it needs to add a new line, especially if you've rearranged things? If that's the case, then I feel like the generator needs to display some kind of instructions when you run it to inform the user that they need to do this manually. For instance, if you ran rails g administrate:dashboard Foo, you would see something like:

As you can see above, Administrate created files for the new dashboard. However, right now you won't see a new item in the sidebar. To make that happen, you'll need to add a new line to your existing admin-related routes. For instance:

resources :foos
@rnice01
Copy link
Contributor

rnice01 commented Sep 21, 2017

Is this still open for PRs? I'm new to the Rails community is it common for the routes.rb file to be in a different folder? Seems like a lot of stuff in the install generator process relies on routes.rb to be in the config folder and not just the routes generator.

@nickcharlton
Copy link
Member

Hi @rnice01!

Sure is!

It might be in a different place if you're using a lot of Rails Engines and so administrate (an Engine itself) might not be able to determine where to put things.

@rnicedep
Copy link

@nickcharlton Thanks for getting back to me, I'd love to work on something for this. After looking at the install and routes generator, it looks like both of them are looking directly at the /config directory from the Rails root for the routes.rb file.

My idea for this PR is to create a generator helper method to first check where the routes.rb would be, like it is now, and if it can't find it then do a quick search through the project's directories from the Rails root for the routes.rb file. This could then be used in any generator needing to find the routes.rb file like the install and routes generators. What are your thoughts for this?

@nickcharlton
Copy link
Member

That sounds like a good idea! I look forward to seeing it.

rnice01 added a commit to rnice01/administrate that referenced this issue Oct 7, 2017
thoughtbot#720

Because there may be Rails projects with the routes.rb
file in a different location  than Rails.root/config a
helper was added to locate the file. The helper will look
in the 'normal' routes.rb location and then search through
the project if not located there.
dyba pushed a commit to dyba/administrate that referenced this issue Feb 11, 2018
thoughtbot#720

Because there may be Rails projects with the routes.rb
file in a different location  than Rails.root/config a
helper was added to locate the file. The helper will look
in the 'normal' routes.rb location and then search through
the project if not located there.
dyba pushed a commit to dyba/administrate that referenced this issue Feb 11, 2018
thoughtbot#720

Because there may be Rails projects with the routes.rb
file in a different location  than Rails.root/config a
helper was added to locate the file. The helper will look
in the 'normal' routes.rb location and then search through
the project if not located there.
dyba pushed a commit to dyba/administrate that referenced this issue Feb 11, 2018
thoughtbot#720

Because there may be Rails projects with the routes.rb
file in a different location  than Rails.root/config a
helper was added to locate the file. The helper will look
in the 'normal' routes.rb location and then search through
the project if not located there.
@nickcharlton nickcharlton added feature new functionality that’s not yet implemented install initial setup, first-run experience, generators and removed Progressive labels Jan 2, 2020
nickcharlton pushed a commit to rnice01/administrate that referenced this issue Oct 6, 2020
Because there may be Rails projects with the routes.rb
file in a different location  than Rails.root/config a
helper was added to locate the file. The helper will look
in the 'normal' routes.rb location and then search through
the project if not located there.

Fixes thoughtbot#720
nickcharlton pushed a commit to rnice01/administrate that referenced this issue Oct 6, 2020
Because there may be Rails projects with the routes.rb
file in a different location  than Rails.root/config a
helper was added to locate the file. The helper will look
in the 'normal' routes.rb location and then search through
the project if not located there.

Fixes thoughtbot#720
@pablobm
Copy link
Collaborator

pablobm commented Apr 23, 2021

I'm going to close this one as there hasn't been any activity in a long time.

@pablobm pablobm closed this as completed Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature new functionality that’s not yet implemented install initial setup, first-run experience, generators
Projects
None yet
Development

No branches or pull requests

8 participants