Module: ActiveRecord::VirtualBase::TablelessMetaMethods

Defined in:
lib/galaxy/virtual_base.rb

Instance Method Summary collapse

Instance Method Details

#column(name, sql_type = nil, default = nil, null = true) ⇒ Object



138
139
140
141
# File 'lib/galaxy/virtual_base.rb', line 138

def column(name, sql_type = nil, default = nil, null = true)
  columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
  reset_column_information
end

#columnsObject



134
135
136
# File 'lib/galaxy/virtual_base.rb', line 134

def columns()
  @columns ||= []
end

#reset_column_informationObject

Do not reset @columns



144
145
146
147
# File 'lib/galaxy/virtual_base.rb', line 144

def reset_column_information
  generated_methods.each { |name| undef_method(name) }
  @column_names = @columns_hash = @content_columns = @dynamic_methods_hash = @read_methods = nil
end