Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

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
Closed

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

existentialmutt opened this issue Dec 7, 2009 · 2 comments

Comments

@existentialmutt
Copy link

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
@grimen
Copy link
Contributor

grimen commented Dec 17, 2009

@justinfrench
Copy link
Member

pulled in, closing.

zuf pushed a commit to zuf/formtastic that referenced this issue Sep 7, 2012
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants