From 10ad15861f5eb48c2634c94a62f51eb83e559f66 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sat, 3 Apr 2010 18:22:17 -0300 Subject: :action => "update" used in a non RESTful way confuses --- actionpack/lib/action_view/helpers/form_helper.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 6a14f0be9c..6aaaac57a6 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -121,7 +121,7 @@ module ActionView # The generic way to call +form_for+ yields a form builder around a # model: # - # <%= form_for :person, :url => { :action => "update" } do |f| %> + # <%= form_for :person do |f| %> # <%= f.error_messages %> # First name: <%= f.text_field :first_name %>
# Last name : <%= f.text_field :last_name %>
@@ -145,7 +145,7 @@ module ActionView # If the instance variable is not @person you can pass the actual # record as the second argument: # - # <%= form_for :person, person, :url => { :action => "update" } do |f| %> + # <%= form_for :person, person do |f| %> # ... # <% end %> # @@ -177,7 +177,7 @@ module ActionView # possible to use both the stand-alone FormHelper methods and methods # from FormTagHelper. For example: # - # <%= form_for :person, @person, :url => { :action => "update" } do |f| %> + # <%= form_for :person, @person do |f| %> # First name: <%= f.text_field :first_name %> # Last name : <%= f.text_field :last_name %> # Biography : <%= text_area :person, :biography %> @@ -265,7 +265,7 @@ module ActionView # custom builder. For example, let's say you made a helper to # automatically add labels to form inputs. # - # <%= form_for :person, @person, :url => { :action => "update" }, :builder => LabellingFormBuilder do |f| %> + # <%= form_for :person, @person, :builder => LabellingFormBuilder do |f| %> # <%= f.text_field :first_name %> # <%= f.text_field :last_name %> # <%= text_area :person, :biography %> @@ -342,7 +342,7 @@ module ActionView # # === Generic Examples # - # <%= form_for @person, :url => { :action => "update" } do |person_form| %> + # <%= form_for @person do |person_form| %> # First name: <%= person_form.text_field :first_name %> # Last name : <%= person_form.text_field :last_name %> # @@ -404,7 +404,7 @@ module ActionView # # This model can now be used with a nested fields_for, like so: # - # <%= form_for @person, :url => { :action => "update" } do |person_form| %> + # <%= form_for @person do |person_form| %> # ... # <%= person_form.fields_for :address do |address_fields| %> # Street : <%= address_fields.text_field :street %> @@ -433,7 +433,7 @@ module ActionView # with a value that evaluates to +true+, you will destroy the associated # model (eg. 1, '1', true, or 'true'): # - # <%= form_for @person, :url => { :action => "update" } do |person_form| %> + # <%= form_for @person do |person_form| %> # ... # <%= person_form.fields_for :address do |address_fields| %> # ... @@ -461,7 +461,7 @@ module ActionView # the nested fields_for call will be repeated for each instance in the # collection: # - # <%= form_for @person, :url => { :action => "update" } do |person_form| %> + # <%= form_for @person do |person_form| %> # ... # <%= person_form.fields_for :projects do |project_fields| %> # <% if project_fields.object.active? %> @@ -472,7 +472,7 @@ module ActionView # # It's also possible to specify the instance to be used: # - # <%= form_for @person, :url => { :action => "update" } do |person_form| %> + # <%= form_for @person do |person_form| %> # ... # <% @person.projects.each do |project| %> # <% if project.active? %> @@ -485,7 +485,7 @@ module ActionView # # Or a collection to be used: # - # <%= form_for @person, :url => { :action => "update" } do |person_form| %> + # <%= form_for @person do |person_form| %> # ... # <%= person_form.fields_for :projects, @active_projects do |project_fields| %> # Name: <%= project_fields.text_field :name %> @@ -514,7 +514,7 @@ module ActionView # parameter with a value that evaluates to +true+ # (eg. 1, '1', true, or 'true'): # - # <%= form_for @person, :url => { :action => "update" } do |person_form| %> + # <%= form_for @person do |person_form| %> # ... # <%= person_form.fields_for :projects do |project_fields| %> # Delete: <%= project_fields.check_box :_destroy %> -- cgit v1.2.3 From 8f9becb42632d68ae84639b19022ff7d64666a30 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sat, 3 Apr 2010 18:34:28 -0300 Subject: :action => "create" added to form_for with name only to show appropiate behavior --- actionpack/lib/action_view/helpers/form_helper.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 6aaaac57a6..9467a0912a 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -121,7 +121,7 @@ module ActionView # The generic way to call +form_for+ yields a form builder around a # model: # - # <%= form_for :person do |f| %> + # <%= form_for :person, :url => { :action => "create" } do |f| %> # <%= f.error_messages %> # First name: <%= f.text_field :first_name %>
# Last name : <%= f.text_field :last_name %>
@@ -145,7 +145,7 @@ module ActionView # If the instance variable is not @person you can pass the actual # record as the second argument: # - # <%= form_for :person, person do |f| %> + # <%= form_for :person, person, :url => { :action => "create" } do |f| %> # ... # <% end %> # @@ -177,7 +177,7 @@ module ActionView # possible to use both the stand-alone FormHelper methods and methods # from FormTagHelper. For example: # - # <%= form_for :person, @person do |f| %> + # <%= form_for :person, @person, :url => { :action => "create" } do |f| %> # First name: <%= f.text_field :first_name %> # Last name : <%= f.text_field :last_name %> # Biography : <%= text_area :person, :biography %> @@ -265,7 +265,7 @@ module ActionView # custom builder. For example, let's say you made a helper to # automatically add labels to form inputs. # - # <%= form_for :person, @person, :builder => LabellingFormBuilder do |f| %> + # <%= form_for :person, @person, :url => { :action => "create" }, :builder => LabellingFormBuilder do |f| %> # <%= f.text_field :first_name %> # <%= f.text_field :last_name %> # <%= text_area :person, :biography %> @@ -354,13 +354,13 @@ module ActionView # ...or if you have an object that needs to be represented as a different # parameter, like a Client that acts as a Person: # - # <%= fields_for :person, @client do |permission_fields| %> + # <%= fields_for :person, @client, :url => { :action => "create" } do |permission_fields| %> # Admin?: <%= permission_fields.check_box :admin %> # <% end %> # # ...or if you don't have an object, just a name of the parameter: # - # <%= fields_for :person do |permission_fields| %> + # <%= fields_for :person, :url => { :action => "create" } do |permission_fields| %> # Admin?: <%= permission_fields.check_box :admin %> # <% end %> # -- cgit v1.2.3 From 48b2451142355b22de5f8130b3debdd4e53e2ba2 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Sun, 4 Apr 2010 17:34:13 +0100 Subject: Update various documentation examples to use new routing DSL --- actionpack/lib/action_controller/record_identifier.rb | 2 +- actionpack/lib/action_dispatch/routing/url_for.rb | 2 +- actionpack/lib/action_view/helpers/atom_feed_helper.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/record_identifier.rb b/actionpack/lib/action_controller/record_identifier.rb index 7fdaffe3eb..fe2f6cee70 100644 --- a/actionpack/lib/action_controller/record_identifier.rb +++ b/actionpack/lib/action_controller/record_identifier.rb @@ -6,7 +6,7 @@ module ActionController # the view actions to a higher logical level. Example: # # # routes - # map.resources :posts + # resources :posts # # # view # <% div_for(post) do %>
diff --git a/actionpack/lib/action_dispatch/routing/url_for.rb b/actionpack/lib/action_dispatch/routing/url_for.rb index dd86aa3e87..fb236dce53 100644 --- a/actionpack/lib/action_dispatch/routing/url_for.rb +++ b/actionpack/lib/action_dispatch/routing/url_for.rb @@ -63,7 +63,7 @@ module ActionDispatch # named routes. For example, suppose that you have a 'users' resource in your # routes.rb: # - # map.resources :users + # resources :users # # This generates, among other things, the method users_path. By default, # this method is accessible from your controllers, views and mailers. If you need diff --git a/actionpack/lib/action_view/helpers/atom_feed_helper.rb b/actionpack/lib/action_view/helpers/atom_feed_helper.rb index 58c3a8752e..52806f206a 100644 --- a/actionpack/lib/action_view/helpers/atom_feed_helper.rb +++ b/actionpack/lib/action_view/helpers/atom_feed_helper.rb @@ -9,8 +9,8 @@ module ActionView # # config/routes.rb: # Basecamp::Application.routes.draw do |map| - # map.resources :posts - # map.root :controller => "posts" + # resources :posts + # root :to => "posts#index" # end # # app/controllers/posts_controller.rb: -- cgit v1.2.3