diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-11-14 21:00:26 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-11-14 21:00:26 -0200 |
commit | c996901913d74640afb1856044e5a5d6bd12a7fd (patch) | |
tree | 858b4c292be40b984bbee3352735a708acbea1ec /railties/guides | |
parent | bc556a21e2d5722f42dfac810c04d453076e09fb (diff) | |
download | rails-c996901913d74640afb1856044e5a5d6bd12a7fd.tar.gz rails-c996901913d74640afb1856044e5a5d6bd12a7fd.tar.bz2 rails-c996901913d74640afb1856044e5a5d6bd12a7fd.zip |
Change deprecated syntax and use f.submit instead of submit_tag
Diffstat (limited to 'railties/guides')
-rw-r--r-- | railties/guides/source/form_helpers.textile | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/railties/guides/source/form_helpers.textile b/railties/guides/source/form_helpers.textile index 80e0421b48..35b9d486b9 100644 --- a/railties/guides/source/form_helpers.textile +++ b/railties/guides/source/form_helpers.textile @@ -232,13 +232,13 @@ The corresponding view +app/views/articles/new.html.erb+ using +form_for+ looks <%= form_for @article, :url => { :action => "create" }, :html => {:class => "nifty_form"} do |f| %> <%= f.text_field :title %> <%= f.text_area :body, :size => "60x12" %> - <%= submit_tag "Create" %> + <%= f.submit "Create" %> <% end %> </erb> There are a few things to note here: -# +:article+ is the name of the model and +@article+ is the actual object being edited. +# +@article+ is the actual object being edited. # There is a single hash of options. Routing options are passed in the +:url+ hash, HTML options are passed in the +:html+ hash. # The +form_for+ method yields a *form builder* object (the +f+ variable). # Methods to create form controls are called *on* the form builder object +f+ @@ -294,13 +294,13 @@ When dealing with RESTful resources, calls to +form_for+ can get significantly e <ruby> ## Creating a new article # long-style: -form_for(:article, @article, :url => articles_path) +form_for(@article, :url => articles_path) # same thing, short-style (record identification gets used): form_for(@article) ## Editing an existing article # long-style: -form_for(:article, @article, :url => article_path(@article), :html => { :method => "put" }) +form_for(@article, :url => article_path(@article), :html => { :method => "put" }) # short-style: form_for(@article) </ruby> |