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

Issue #4941 , handle error 'Please specify the Rails release the migr… #4942

Merged
merged 1 commit into from
Oct 3, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/generators/active_record/devise_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def inet?
postgresql?
end

def rails5?
Rails.version.start_with? '5'
def rails5_and_up?
Rails::VERSION::MAJOR >= 5
Copy link
Collaborator

Choose a reason for hiding this comment

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

This constant is private. Maybe Rails.gem_version >= Gem::Version('5.0.0')?

Copy link
Collaborator

@rafaelfranca rafaelfranca Sep 25, 2018

Choose a reason for hiding this comment

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

Ah, it is public, so this is fine.

end

def postgresql?
Expand All @@ -92,13 +92,13 @@ def postgresql?
end

def migration_version
if rails5?
if rails5_and_up?
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
end
end

def primary_key_type
primary_key_string if rails5?
primary_key_string if rails5_and_up?
end

def primary_key_string
Expand Down