Skip to content
Browse files

Use Array.wrap instead of using ternary

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent 6f89582 commit e12810178cebc0c40a90b4aba3976537852b71b4 @drogus drogus committed with josevalim
View
2 activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -443,7 +443,7 @@ def initialize_schema_migrations_table
end
def assume_migrated_upto_version(version, migrations_paths = ActiveRecord::Migrator.migrations_paths)
- migrations_paths = [migrations_paths] unless migrations_paths.kind_of?(Array)
+ migrations_paths = Array.wrap(migrations_paths)
version = version.to_i
sm_table = quote_table_name(ActiveRecord::Migrator.schema_migrations_table_name)
View
4 activerecord/lib/active_record/migration.rb
@@ -573,7 +573,7 @@ def proper_table_name(name)
def migrations_paths
@migrations_paths ||= ['db/migrate']
# just to not break things if someone uses: migration_path = some_string
- @migrations_paths.kind_of?(Array) ? @migrations_paths : [@migrations_paths]
+ Array.wrap(@migrations_paths)
end
def migrations_path
@@ -581,7 +581,7 @@ def migrations_path
end
def migrations(paths)
- paths = [paths] unless paths.kind_of?(Array)
+ paths = Array.wrap(paths)
files = Dir[*paths.map { |p| "#{p}/[0-9]*_*.rb" }]

1 comment on commit e128101

@carlosantoniodasilva
Ruby on Rails member

These files should have the require call to Array.wrap now, shouldn't they?

Please sign in to comment.
Something went wrong with that request. Please try again.