diff options
author | Jon Leighton <j@jonathanleighton.com> | 2013-02-15 16:08:47 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2013-02-15 16:08:57 +0000 |
commit | 8aa4603a5adaa56c818a7bd1c0b761b4ecca3d3e (patch) | |
tree | 5406fc7cfeeea3a5dc07c83982dd30fdbf6d6209 /activerecord | |
parent | a159f471e4876eab6e34214e11ee006d714ebf8a (diff) | |
download | rails-8aa4603a5adaa56c818a7bd1c0b761b4ecca3d3e.tar.gz rails-8aa4603a5adaa56c818a7bd1c0b761b4ecca3d3e.tar.bz2 rails-8aa4603a5adaa56c818a7bd1c0b761b4ecca3d3e.zip |
Revert "Merge pull request #9206 from ranjaykrishna/use_define_method"
This reverts commit 1fc6876b57f2e1d31731e74eb4271b5655e746d2, reversing
changes made to 0268b5d8cdc3c5a1337462135f0a326a2654ba1a.
Reason: failing test
1) Error:
test_valid_column(ActiveRecord::ConnectionAdapters::SQLite3AdapterTest):
NoMethodError: undefined method `column' for
test/cases/adapters/sqlite3/sqlite3_adapter_test.rb:29:in
`test_valid_column'
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index f758e19a4f..b1ec33d06c 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -252,12 +252,15 @@ module ActiveRecord self end - [:string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean].each do |column_type| - define_method column_type do |*args| - options = args.extract_options! - column_names = args - column_names.each { |name| column(name, column_type, options) } - end + %w( string text integer float decimal datetime timestamp time date binary boolean ).each do |column_type| + class_eval <<-EOV, __FILE__, __LINE__ + 1 + def #{column_type}(*args) # def string(*args) + options = args.extract_options! # options = args.extract_options! + column_names = args # column_names = args + type = :'#{column_type}' # type = :string + column_names.each { |name| column(name, type, options) } # column_names.each { |name| column(name, type, options) } + end # end + EOV end # Adds index options to the indexes hash, keyed by column name @@ -483,13 +486,15 @@ module ActiveRecord # # t.string(:goat) # t.string(:goat, :sheep) - [:string, :text, :integer, :float, :decimal, :datetime, :timestamp, :time, :date, :binary, :boolean].each do |column_type| - define_method column_type do |*args| - options = args.extract_options! - args.each do |name| - @base.add_column(@table_name, name, column_type, options) - end - end + %w( string text integer float decimal datetime timestamp time date binary boolean ).each do |column_type| + class_eval <<-EOV, __FILE__, __LINE__ + 1 + def #{column_type}(*args) # def string(*args) + options = args.extract_options! # options = args.extract_options! + args.each do |name| # column_names.each do |name| + @base.add_column(@table_name, name, :#{column_type}, options) # @base.add_column(@table_name, name, :string, options) + end # end + end # end + EOV end private |