Sha256: eb7c38d7ff9e558e0eaf0caab0254bf9bcd9380da27b17ebabbdb8e81d939ff8

Contents?: true

Size: 720 Bytes

Versions: 9

Compression:

Stored size: 720 Bytes

Contents

module ActiveRecord::ConnectionAdapters

  class TableDefinition

    def fkey(*args)
      options = take_options!(args)
      args.each {|col| column("#{col}_id".to_sym, :integer, options)}
    end

    def auto_dates
      column :created_at, :datetime
      column :updated_at, :datetime
    end

    def method_missing(name, *args)
      if name.in? [:integer, :float, :decimal, :datetime, :date, :timestamp,
                      :time, :text, :string, :binary, :boolean ]
        options = take_options!(args)
        args.each {|col| column(col, name, options)}
      else
        super
      end
    end


    private

    def take_options!(args)
      args.last.is_a?(Hash) ? args.pop : {}
    end

  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hobo-0.6.3 hobo_files/plugin/lib/active_record/table_definition.rb
hobo-0.5.3 hobo_files/plugin/lib/active_record/table_definition.rb
hobo-0.6 hobo_files/plugin/lib/active_record/table_definition.rb
hobo-0.6.1 hobo_files/plugin/lib/active_record/table_definition.rb
hobo-0.6.2 hobo_files/plugin/lib/active_record/table_definition.rb
hobo-0.6.4 hobo_files/plugin/lib/active_record/table_definition.rb
hobo-0.7.0 hobo_files/plugin/lib/active_record/table_definition.rb
hobo-0.7.1 hobo_files/plugin/lib/active_record/table_definition.rb
hobo-0.7.2 hobo_files/plugin/lib/active_record/table_definition.rb