Module: Findable::Schema::ClassMethods
- Defined in:
- lib/findable/schema.rb
Instance Method Summary collapse
Instance Method Details
#column_names ⇒ Object
16 17 18 |
# File 'lib/findable/schema.rb', line 16 def column_names @_column_names ||= [:id] end |
#define_field(*args) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/findable/schema.rb', line 28 def define_field(*args) = args. name = args.first if !public_method_defined?(name) || .present? define_attribute_methods name conversion = Findable::Schema::Conversion.to([:type]) define_method(name) { conversion.call(attributes[name.to_sym]) } indexes << name.to_sym if [:index] column_names << name.to_sym end end |
#index_defined? ⇒ Boolean
24 25 26 |
# File 'lib/findable/schema.rb', line 24 def index_defined? indexes.size > 1 end |
#indexes ⇒ Object
20 21 22 |
# File 'lib/findable/schema.rb', line 20 def indexes @_indexes ||= [:id] end |