Sha256: f5d748bdfb8a807314f01565ad98fd673a80fe251c0bbfeab45b77ae1ab1bde1

Contents?: true

Size: 699 Bytes

Versions: 7

Compression:

Stored size: 699 Bytes

Contents

=begin rdoc
This responds to the same methods as ActiveRecord::ConnectionAdapter::Column.
It exists to pretend that the accessors generated by association methods
have a column type of :association, which lets us make a sensible paste
decision using PasteRole, and makes the field/attribute distinction possible
in ModelIndex.
=end
class ModelColumn
  attr_accessor :primary, :scale, :sql_type, :name, :precision, :default, :limit, :type, :meta
  
  def initialize( name, type, meta )
    @name = name
    @type = type
    @meta = meta
  end
  
  # return the underlying field name, ie "#{attribute}_id" if
  # it's an association
  alias_method :old_name, :name
  def name
    @meta.name
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
clevic-0.12.0 lib/clevic/model_column.rb
clevic-0.11.1 lib/clevic/model_column.rb
clevic-0.7.0 lib/clevic/model_column.rb
clevic-0.5.2 lib/clevic/model_column.rb
clevic-0.6.0 lib/clevic/model_column.rb
clevic-0.8.0 lib/clevic/model_column.rb
clevic-0.5.1 lib/clevic/model_column.rb