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

fix NameError for rails < 4.2.0 #30

Merged
merged 2 commits into from
Dec 31, 2014
Merged

fix NameError for rails < 4.2.0 #30

merged 2 commits into from
Dec 31, 2014

Conversation

cantonic
Copy link
Contributor

::Rails::Generators::ModelHelpers exists since rails 4.2.0.
In prior versions ::Rails::Generators::ResourceHelpers handles the
warn message.

this fixes #29

`::Rails::Generators::ModelHelpers` exists since rails 4.2.0.
In prior versions `::Rails::Generators::ResourceHelpers` handles the
warn message.

this fixes #29
module_name = case ::Rails::Generators.const_defined? 'ModelHelpers'
when true then 'ModelHelpers'
else 'ResourceHelpers'
end
Copy link
Member

Choose a reason for hiding this comment

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

Why not this?

module_name = ::Rails::Generators.const_defined?('ModelHelpers') ? 'ModelHelpers' : 'ResourceHelpers'

(or using if/else, which is the same)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was totally overtired when writing this. No clue why I used a switch statement here :)

elia added a commit that referenced this pull request Dec 31, 2014
Fix NameError in generator for Rails < 4.2
@elia elia merged commit 5a0c0aa into opal:master Dec 31, 2014
@elia
Copy link
Member

elia commented Dec 31, 2014

Thanks! — and get some rest! ;D

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.

'rails generate controller' fails at Opal::Generators::AssetsGenerator
2 participants