Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

let form generators use do |f| instead of do |form| #151

Closed
existentialmutt opened this Issue Dec 7, 2009 · 2 comments

Comments

Projects
None yet
3 participants

So every time I download this plugin I change the formtastic form generator to use |f| in place of |form| for it's iterator variable. This lets the snippets in the Formtastic and Rails bundles work with these forms. It's a simple fix-- here's the diff. What's the reason for using |form|?

diff --git a/generators/form/templates/view__form.html.erb b/generators/form/templates/view__form.html.erb
index d444c3c..21daaab 100644
--- a/generators/form/templates/view__form.html.erb
+++ b/generators/form/templates/view__form.html.erb
@@ -1,5 +1,5 @@
-<%% form.inputs do %>
+<%% f.inputs do %>
<% attributes.each do |attribute| -%>

  • <%%= form.input :<%= attribute.name %>, :label => '<%= attribute.name.humanize %>' %>
  • <%%= f.input :<%= attribute.name %>, :label => '<%= attribute.name.humanize %>' %>
    <% end -%>
    <%% end %>
    \ No newline at end of file
    diff --git a/generators/form/templates/view__form.html.haml b/generators/form/templates/view__form.html.haml
    index 52b2fa9..5e06093 100644
    --- a/generators/form/templates/view__form.html.haml
    +++ b/generators/form/templates/view__form.html.haml
    @@ -1,4 +1,4 @@
    -- form.inputs do
    +- f.inputs do
    <% attributes.each do |attribute| -%>
  • = form.input :<%= attribute.name %>, :label => '<%= attribute.name.humanize %>'
  • = f.input :<%= attribute.name %>, :label => '<%= attribute.name.humanize %>'
    <% end -%>
    \ No newline at end of file
Owner

justinfrench commented Jan 1, 2010

pulled in, closing.

@zuf zuf pushed a commit to zuf/formtastic that referenced this issue Sep 7, 2012

@grimen @justinfrench grimen + justinfrench Form generator: |f| is a better default for |form|. Also works better…
… with the bundle. Closing #151.
e57b9d1

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment