Module: Blocks::ViewExtensions

Defined in:
lib/blocks/action_view_extensions/view_extensions.rb

Instance Method Summary collapse

Instance Method Details

#blocksObject



5
6
7
# File 'lib/blocks/action_view_extensions/view_extensions.rb', line 5

def blocks
  @blocks ||= Blocks.builder_class.new(self)
end

#render_with_overrides(*args, &block) ⇒ Object Also known as: with_template



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/blocks/action_view_extensions/view_extensions.rb', line 9

def render_with_overrides(*args, &block)
  options = args.extract_options!.with_indifferent_access
  partial = options.delete(:partial) || options.delete(:template) || args.first
  if builder = options.delete(:builder)
    builder.view = self
    # builder = builder.clone
    # TODO: figure out what to do here
  else
    # TODO: options shouldn't have to be passed both here and to the render_with_overrides call below - need it to be just one place
    builder = Blocks.builder_class.new(self, options)
  end
  builder.render_with_overrides(options.merge(partial: partial), &block)
end