Class: ArDocStore::Attributes::Date

Inherits:
Base
  • Object
show all
Defined in:
lib/ar_doc_store/attributes/date.rb

Instance Attribute Summary

Attributes inherited from Base

#attribute, #conversion, #default, #model, #options, #predicate

Instance Method Summary collapse

Methods inherited from Base

#add_ransacker, #attribute_options, #build, build, #embedded?, #initialize, #store_attribute

Methods included from CallbackSupport

included

Constructor Details

This class inherits a constructor from ArDocStore::Attributes::Base

Instance Method Details

#attribute_typeObject



18
19
20
# File 'lib/ar_doc_store/attributes/date.rb', line 18

def attribute_type
  ActiveRecord::Type::Date
end

#define_query_methodObject



6
7
8
9
10
11
12
# File 'lib/ar_doc_store/attributes/date.rb', line 6

def define_query_method
  model.class_eval <<-CODE, __FILE__, __LINE__ + 1
    def #{attribute}?
      #{attribute}.present?
    end
  CODE
end

#typeObject



14
15
16
# File 'lib/ar_doc_store/attributes/date.rb', line 14

def type
  :date
end