Class: ActionBlocks::AttachmentBuilder
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
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?
Instance Method Details
#before_build(parent, *args) ⇒ Object
506
507
508
509
510
|
# File 'lib/action_blocks/builders/model_builder.rb', line 506
def before_build(parent, *args)
super(parent, *args)
@attachment_type = 'image'
@field_type = 'attachment'
end
|
#hashify(user) ⇒ Object
526
527
528
529
530
531
532
533
|
# File 'lib/action_blocks/builders/model_builder.rb', line 526
def hashify(user)
{
type: :attachment,
attachment_type: @attachment_type,
id: @id,
model_key: @parent_model.key
}
end
|
#match_requirements(select_as_prefix = nil) ⇒ Object
519
520
521
522
523
524
|
# File 'lib/action_blocks/builders/model_builder.rb', line 519
def match_requirements(select_as_prefix = nil)
raise "should not use attachment in match conditions"
{
path: [select_as_prefix, @id].compact
}
end
|
#select_requirements(select_as_prefix = nil) ⇒ Object
512
513
514
515
516
517
|
# File 'lib/action_blocks/builders/model_builder.rb', line 512
def select_requirements(select_as_prefix = nil)
{
field_name: [select_as_prefix,@id].compact.join('_').to_sym,
path: [:id]
}
end
|