Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #7932: method_missing_for_table_definitions.diff

File method_missing_for_table_definitions.diff, 1.3 kB (added by norbert, 1 year ago)
  • activerecord/test/migration_test.rb

    old new  
    9393      Person.connection.drop_table :testings rescue nil 
    9494    end 
    9595 
     96    def test_create_table_with_method_missing 
     97      Person.connection.create_table :testings do |t| 
     98        t.foo :string 
     99      end 
     100 
     101      assert_equal %w(foo id), 
     102        Person.connection.columns(:testings).map { |c| c.name }.sort 
     103    ensure 
     104      Person.connection.drop_table :testings rescue nil 
     105    end 
     106 
    96107    def test_create_table_with_not_null_column 
    97108      assert_nothing_raised do 
    98109        Person.connection.create_table :testings do |t| 
  • activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb

    old new  
    340340        @columns * ', ' 
    341341      end 
    342342 
     343      def method_missing(name, *args) 
     344        column(name, *args) 
     345      end 
     346 
    343347      private 
    344348        def native 
    345349          @base.native_database_types