Object
This is used for the block variable given to form_for. Typically, an erb template looks as so:
<% form_for :foo do |f| <%= f.text_field :bar %> <% end %>
form_for adds the form tag to the input stream, and assumes that later the user will append the tag to the input stream himself (in erb, this is done with the <%= %> tags).
We could do the following in Markaby:
form_for :foo do |f| text f.text_field(:bar) end
But this is ugly. This is prettier:
form_for :foo do |f| f.text_field :bar end
# File lib/markaby/rails/rails_builder.rb, line 72 72: def __template__ 73: @view.template 74: end
# File lib/markaby/rails/rails_builder.rb, line 68 68: def __template__ 69: @view.instance_variable_get("@_last_render") 70: end
# File lib/markaby/rails/rails_builder.rb, line 77 77: def method_missing(sym, *args, &block) 78: result = @proxied_object.__send__(sym, *args, &block) 79: 80: # a markaby template may call render :partial with the form proxy helper. 81: # we only want to manually concat _if_ we are in a markaby template (not, say, erb) 82: if __template__.extension == "mab" 83: @view.concat(result) 84: end 85: 86: result 87: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.