Created
May 14, 2011 02:35
-
-
Save AquaGeek/971846 to your computer and use it in GitHub Desktop.
Rails Lighthouse ticket #6738
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From fe2fd8e361205dca71bb843aa91bbd84bd397072 Mon Sep 17 00:00:00 2001 | |
| From: Sebastian Martinez <[email protected]> | |
| Date: Fri, 22 Apr 2011 21:57:52 -0300 | |
| Subject: [PATCH] Remove useless argument | |
| --- | |
| .../abstract/connection_pool.rb | 2 +- | |
| .../abstract/schema_statements.rb | 2 +- | |
| .../connection_adapters/mysql2_adapter.rb | 2 +- | |
| .../connection_adapters/mysql_adapter.rb | 2 +- | |
| .../connection_adapters/postgresql_adapter.rb | 2 +- | |
| .../connection_adapters/sqlite_adapter.rb | 2 +- | |
| activerecord/lib/active_record/reflection.rb | 4 ++-- | |
| .../connection_adapters/fake_adapter.rb | 2 +- | |
| activerecord/test/cases/migration_test.rb | 9 ++++----- | |
| 9 files changed, 13 insertions(+), 14 deletions(-) | |
| diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | |
| index b4db1ee..c545b9f 100644 | |
| --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | |
| +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | |
| @@ -90,7 +90,7 @@ module ActiveRecord | |
| h[table_name] = with_connection do |conn| | |
| # Fetch a list of columns | |
| - conn.columns(table_name, "#{table_name} Columns").tap do |columns| | |
| + conn.columns(table_name).tap do |columns| | |
| # set primary key information | |
| columns.each do |column| | |
| diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | |
| index 8bae508..c4d1e04 100644 | |
| --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | |
| +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | |
| @@ -50,7 +50,7 @@ module ActiveRecord | |
| # Returns an array of Column objects for the table specified by +table_name+. | |
| # See the concrete implementation for details on the expected parameter values. | |
| - def columns(table_name, name = nil) end | |
| + def columns(table_name) end | |
| # Checks to see if a column exists in a given table. | |
| # | |
| diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb | |
| index 7ac72ac..ecd0d0b 100644 | |
| --- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb | |
| +++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb | |
| @@ -423,7 +423,7 @@ module ActiveRecord | |
| indexes | |
| end | |
| - def columns(table_name, name = nil) | |
| + def columns(table_name) | |
| sql = "SHOW FIELDS FROM #{quote_table_name(table_name)}" | |
| columns = [] | |
| result = execute(sql) | |
| diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | |
| index 2c05ff2..5c0eb32 100644 | |
| --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | |
| +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb | |
| @@ -625,7 +625,7 @@ module ActiveRecord | |
| indexes | |
| end | |
| - def columns(table_name, name = nil)#:nodoc: | |
| + def columns(table_name)#:nodoc: | |
| sql = "SHOW FIELDS FROM #{quote_table_name(table_name)}" | |
| columns = [] | |
| result = execute(sql, 'SCHEMA') | |
| diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | |
| index e2b9a5d..120bca0 100644 | |
| --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | |
| +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | |
| @@ -725,7 +725,7 @@ module ActiveRecord | |
| end | |
| # Returns the list of all column definitions for a table. | |
| - def columns(table_name, name = nil) | |
| + def columns(table_name) | |
| # Limit, precision, and scale are all handled by the superclass. | |
| column_definitions(table_name).collect do |column_name, type, default, notnull| | |
| PostgreSQLColumn.new(column_name, default, type, notnull == 'f') | |
| diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb | |
| index e1518f9..1ea3983 100644 | |
| --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb | |
| +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb | |
| @@ -244,7 +244,7 @@ module ActiveRecord | |
| end | |
| end | |
| - def columns(table_name, name = nil) #:nodoc: | |
| + def columns(table_name) #:nodoc: | |
| table_structure(table_name).map do |field| | |
| case field["dflt_value"] | |
| when /^null$/i | |
| diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb | |
| index bcba85d..cf38ff5 100644 | |
| --- a/activerecord/lib/active_record/reflection.rb | |
| +++ b/activerecord/lib/active_record/reflection.rb | |
| @@ -242,8 +242,8 @@ module ActiveRecord | |
| end | |
| end | |
| - def columns(tbl_name, log_msg) | |
| - @columns ||= klass.connection.columns(tbl_name, log_msg) | |
| + def columns(tbl_name) | |
| + @columns ||= klass.connection.columns(tbl_name) | |
| end | |
| def reset_column_information | |
| diff --git a/activerecord/test/active_record/connection_adapters/fake_adapter.rb b/activerecord/test/active_record/connection_adapters/fake_adapter.rb | |
| index 1c29421..6eb9b79 100644 | |
| --- a/activerecord/test/active_record/connection_adapters/fake_adapter.rb | |
| +++ b/activerecord/test/active_record/connection_adapters/fake_adapter.rb | |
| @@ -28,7 +28,7 @@ module ActiveRecord | |
| options[:null]) | |
| end | |
| - def columns(table_name, message) | |
| + def columns(table_name) | |
| @columns[table_name] | |
| end | |
| end | |
| diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb | |
| index bf7565a..c18517b 100644 | |
| --- a/activerecord/test/cases/migration_test.rb | |
| +++ b/activerecord/test/cases/migration_test.rb | |
| @@ -905,20 +905,19 @@ if ActiveRecord::Base.connection.supports_migrations? | |
| def test_change_column | |
| Person.connection.add_column 'people', 'age', :integer | |
| - label = "test_change_column Columns" | |
| - old_columns = Person.connection.columns(Person.table_name, label) | |
| + old_columns = Person.connection.columns(Person.table_name) | |
| assert old_columns.find { |c| c.name == 'age' and c.type == :integer } | |
| assert_nothing_raised { Person.connection.change_column "people", "age", :string } | |
| - new_columns = Person.connection.columns(Person.table_name, label) | |
| + new_columns = Person.connection.columns(Person.table_name) | |
| assert_nil new_columns.find { |c| c.name == 'age' and c.type == :integer } | |
| assert new_columns.find { |c| c.name == 'age' and c.type == :string } | |
| - old_columns = Topic.connection.columns(Topic.table_name, label) | |
| + old_columns = Topic.connection.columns(Topic.table_name) | |
| assert old_columns.find { |c| c.name == 'approved' and c.type == :boolean and c.default == true } | |
| assert_nothing_raised { Topic.connection.change_column :topics, :approved, :boolean, :default => false } | |
| - new_columns = Topic.connection.columns(Topic.table_name, label) | |
| + new_columns = Topic.connection.columns(Topic.table_name) | |
| assert_nil new_columns.find { |c| c.name == 'approved' and c.type == :boolean and c.default == true } | |
| assert new_columns.find { |c| c.name == 'approved' and c.type == :boolean and c.default == false } | |
| assert_nothing_raised { Topic.connection.change_column :topics, :approved, :boolean, :default => true } | |
| -- | |
| 1.7.4.2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment