class Abyme::AbymeBuilder

Public Class Methods

new(association:, form:, context:, partial:) { |self| ... } click to toggle source

If a block is given to the abymize helper it will instanciate a new AbymeBuilder and pass to it the association name (Symbol) the form object, lookup_context optionaly a partial path then yield itself to the block

# File lib/abyme/abyme_builder.rb, line 11
def initialize(association:, form:, context:, partial:, &block)
  @association = association
  @form = form
  @context = context
  @lookup_context = context.lookup_context
  @partial = partial
  yield(self) if block
end

Public Instance Methods

new_records(options = {}, &block) click to toggle source

calls the new_records_for helper method passing association, form and options to it

# File lib/abyme/abyme_builder.rb, line 35
def new_records(options = {}, &block)
  new_records_for(@association, @form, options) do |fields_for_association|
    render_association_partial(@association, fields_for_association, @partial, @context)
  end
end
records(options = {}) click to toggle source

calls the persisted_records_for helper method passing association, form and options to it

# File lib/abyme/abyme_builder.rb, line 25
def records(options = {})
  persisted_records_for(@association, @form, options) do |fields_for_association|
    render_association_partial(@association, fields_for_association, @partial, @context)
  end
end