Skip to content

Instantly share code, notes, and snippets.

@rafaelss
Created April 30, 2012 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaelss/2562237 to your computer and use it in GitHub Desktop.
Save rafaelss/2562237 to your computer and use it in GitHub Desktop.
class MyDecorator
attr_accessor :view_context
def form(&block)
view_context.form_for(TheModel.new, &block)
end
end
<% my_decorator.view_context = self %>
<h1>The Form</h1>
<%= my_decorator.form do |f| %>
<fieldset>
<%= f.text_field :quantity %>
</fieldset>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment