Class: ActionBlocks::DatetimeFieldBuilder

Inherits:
FieldBlock show all
Defined in:
lib/action_blocks/builders/model_builder.rb

Instance Attribute Summary

Attributes inherited from FieldBlock

#field_type, #parent_model

Attributes inherited from BaseBuilder

#dsl_delegate, #id

Instance Method Summary collapse

Methods inherited from FieldBlock

#key, #match_requirements

Methods inherited from BlockType

#is_block?, #type

Methods inherited from BaseBuilder

#after_build, #after_load, array_fields, block_type, builds, builds_many, delegate_class, #evaluate, #freeze, includes_scheme_helpers, #initialize, #is_block?, #key, references, sets, sets_many, #ui_reference, #valid?

Constructor Details

This class inherits a constructor from ActionBlocks::BaseBuilder

Instance Method Details

#before_build(parent, *args) ⇒ Object



479
480
481
482
# File 'lib/action_blocks/builders/model_builder.rb', line 479

def before_build(parent, *args)
  super(parent, *args)
  @field_type = 'datetime'
end

#hashify(user) ⇒ Object



492
493
494
495
496
497
# File 'lib/action_blocks/builders/model_builder.rb', line 492

def hashify(user)
  {
    type: :datetime,
    id: @id
  }
end

#select_requirements(select_as_prefix = nil) ⇒ Object



484
485
486
487
488
489
490
# File 'lib/action_blocks/builders/model_builder.rb', line 484

def select_requirements(select_as_prefix = nil)
  {
    field_name: [select_as_prefix,@id].compact.join('_').to_sym,
    path: [@id],
    function: -> (*args) { timezone('US/Central', *args) }
  }
end