Class: FlexColumns::Definition::FakeColumn

Inherits:
Object
  • Object
show all
Defined in:
lib/flex_columns/definition/fake_column.rb

Overview

This is a class that complies with just enough of the ActiveRecord interface to columns to be able to be swapped in for it, in our code.

We use this in just one case: when you declare a flex column on a model class whose underlying table doesn’t exist. If you call .reset_column_information on the model in question, we’ll pick up the new, actual column (assuming the table exists now), but, until then, we’ll use this.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ FakeColumn

Returns a new instance of FakeColumn.



12
13
14
# File 'lib/flex_columns/definition/fake_column.rb', line 12

def initialize(name)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/flex_columns/definition/fake_column.rb', line 10

def name
  @name
end

Instance Method Details

#limitObject



24
25
26
# File 'lib/flex_columns/definition/fake_column.rb', line 24

def limit
  nil
end

#nullObject



16
17
18
# File 'lib/flex_columns/definition/fake_column.rb', line 16

def null
  true
end

#typeObject



20
21
22
# File 'lib/flex_columns/definition/fake_column.rb', line 20

def type
  :string
end