Skip to content
This repository
Browse code

Clarification in an example. Grammar correction.

  • Loading branch information...
commit 3aeec3209c04219c3e78cce060e6c0e284e60108 1 parent bf1b1e9
Joseph Pecoraro authored May 29, 2009
10  railties/guides/source/form_helpers.textile
Source Rendered
@@ -211,9 +211,7 @@ h4. Binding a Form to an Object
211 211
 
212 212
 While this is an increase in comfort it is far from perfect. If Person has many attributes to edit then we would be repeating the name of the edited object many times. What we want to do is somehow bind a form to a model object, which is exactly what +form_for+ does.
213 213
 
214  
-Assume we have a controller for dealing with articles:
215  
-
216  
-articles_controller.rb:
  214
+Assume we have a controller for dealing with articles +app/controllers/articles_controller.rb+:
217 215
 
218 216
 <ruby>
219 217
 def new
@@ -221,9 +219,7 @@ def new
221 219
 end
222 220
 </ruby>
223 221
 
224  
-The corresponding view using +form_for+ looks like this
225  
-
226  
-articles/new.html.erb:
  222
+The corresponding view +app/views/articles/new.html.erb+ using +form_for+ looks like this:
227 223
 
228 224
 <erb>
229 225
 <% form_for :article, @article, :url => { :action => "create" }, :html => {:class => "nifty_form"} do |f| %>
@@ -584,7 +580,7 @@ h4. Dealing with Ajax
584 580
 
585 581
 Unlike other forms making an asynchronous file upload form is not as simple as replacing +form_for+ with +remote_form_for+. With an Ajax form the serialization is done by JavaScript running inside the browser and since JavaScript cannot read files from your hard drive the file cannot be uploaded. The most common workaround is to use an invisible iframe that serves as the target for the form submission.
586 582
 
587  
-h3. Customising Form Builders
  583
+h3. Customizing Form Builders
588 584
 
589 585
 As mentioned previously the object yielded by +form_for+ and +fields_for+ is an instance of FormBuilder (or a subclass thereof). Form builders encapsulate the notion of displaying form elements for a single object. While you can of course write helpers for your forms in the usual way you can also subclass FormBuilder and add the helpers there. For example
590 586
 

0 notes on commit 3aeec32

Please sign in to comment.
Something went wrong with that request. Please try again.