mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
adjust method visibility according to it's usage.
`Schema#migrations_paths` is not supposed to be public API. In fact it's only used inside `Schema` itself, so let's make it private.
This commit is contained in:
parent
1663f5ad87
commit
51c0cec9c9
1 changed files with 18 additions and 18 deletions
|
@ -28,24 +28,6 @@ module ActiveRecord
|
||||||
# ActiveRecord::Schema is only supported by database adapters that also
|
# ActiveRecord::Schema is only supported by database adapters that also
|
||||||
# support migrations, the two features being very similar.
|
# support migrations, the two features being very similar.
|
||||||
class Schema < Migration
|
class Schema < Migration
|
||||||
|
|
||||||
# Returns the migrations paths.
|
|
||||||
#
|
|
||||||
# ActiveRecord::Schema.new.migrations_paths
|
|
||||||
# # => ["db/migrate"] # Rails migration path by default.
|
|
||||||
def migrations_paths
|
|
||||||
ActiveRecord::Migrator.migrations_paths
|
|
||||||
end
|
|
||||||
|
|
||||||
def define(info, &block) # :nodoc:
|
|
||||||
instance_eval(&block)
|
|
||||||
|
|
||||||
if info[:version].present?
|
|
||||||
initialize_schema_migrations_table
|
|
||||||
connection.assume_migrated_upto_version(info[:version], migrations_paths)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Eval the given block. All methods available to the current connection
|
# Eval the given block. All methods available to the current connection
|
||||||
# adapter are available within the block, so you can easily use the
|
# adapter are available within the block, so you can easily use the
|
||||||
# database definition DSL to build up your schema (+create_table+,
|
# database definition DSL to build up your schema (+create_table+,
|
||||||
|
@ -60,5 +42,23 @@ module ActiveRecord
|
||||||
def self.define(info={}, &block)
|
def self.define(info={}, &block)
|
||||||
new.define(info, &block)
|
new.define(info, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def define(info, &block) # :nodoc:
|
||||||
|
instance_eval(&block)
|
||||||
|
|
||||||
|
if info[:version].present?
|
||||||
|
initialize_schema_migrations_table
|
||||||
|
connection.assume_migrated_upto_version(info[:version], migrations_paths)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# Returns the migrations paths.
|
||||||
|
#
|
||||||
|
# ActiveRecord::Schema.new.migrations_paths
|
||||||
|
# # => ["db/migrate"] # Rails migration path by default.
|
||||||
|
def migrations_paths # :nodoc:
|
||||||
|
ActiveRecord::Migrator.migrations_paths
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue