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

Avoid writing to routes.rb when no models exist. #713

Merged
merged 1 commit into from
Dec 19, 2016

Conversation

nickcharlton
Copy link
Member

This closes: #502, #516, #555, #649, #583, #601, #613.

@nickcharlton nickcharlton force-pushed the nc-avoid-writing-empty-admin-routes branch from c6f156b to 17991ab Compare December 17, 2016 18:24
Copy link
Contributor

@mike-burns mike-burns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Just one request then LGTM.

@@ -8,7 +8,7 @@ class RoutesGenerator < Rails::Generators::Base
source_root File.expand_path("../templates", __FILE__)

def insert_dashboard_routes
unless File.read(rails_routes_file_path).include?(dashboard_routes)
unless routes_includes_resources? || valid_dashboard_models.empty?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind moving these conditions into a should_route_dashboard? method? I struggle to read unless, especially with a longer logical expression.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I like this idea! Done in a fixup if you'd take a look!

@mike-burns
Copy link
Contributor

LGTM.

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

Successfully merging this pull request may close these issues.

Undefined method 'camelize' for nil:NilClass
2 participants