Module: RequireColumns::ModelAdditions::ClassMethods

Defined in:
lib/require_columns/model_additions.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



4
5
6
# File 'lib/require_columns/model_additions.rb', line 4

def self.extended(base)
  base.send(:validate, :has_required_columns)
end

Instance Method Details

#require_columns(*column) ⇒ Object



12
13
14
15
# File 'lib/require_columns/model_additions.rb', line 12

def require_columns(*column)
  @required_columns ||= []
  @required_columns += column.map(&:to_s)
end

#required_columnsObject



8
9
10
# File 'lib/require_columns/model_additions.rb', line 8

def required_columns
  @required_columns ||= []
end