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 generating invalid root route when there's no model #555

Closed
wants to merge 1 commit into from
Closed

Avoid generating invalid root route when there's no model #555

wants to merge 1 commit into from

Conversation

yujinakayama
Copy link
Contributor

@yujinakayama yujinakayama commented Apr 20, 2016

This fixes #502, and fixes #516.

When there's no model, rails generate administrate:install invokes administrate:routes generator first, and it generates the following invalid routing:

Rails.application.routes.draw do
  namespace :admin do

    root to: "#index"
  end

  ...

... and that causes the error in administrate:dashboard generator.

@@ -63,7 +63,8 @@ def unnamed_constants
end

def dashboard_routes
ERB.new(File.read(routes_file_path)).result(binding)
erb = ERB.new(File.read(routes_file_path), nil, '-')

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

This fixes #502, and fixes #516.

When there's no model, `rails generate administrate:install` invokes
`administrate:routes` generator first,
and it generates the following invalid routing:

```ruby
Rails.application.routes.draw do
  namespace :admin do

    root to: "#index"
  end

  ...
```

... and that causes the error in `administrate:dashboard` generator.
nickcharlton added a commit that referenced this pull request Dec 16, 2016
nickcharlton added a commit that referenced this pull request Dec 17, 2016
nickcharlton added a commit that referenced this pull request Dec 19, 2016
@nickcharlton
Copy link
Member

Closing as this should be fixed with #713. Please open an issue if that's not the case!

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.

Cannot run rails generate administrate:install Undefined method 'camelize' for nil:NilClass
3 participants