Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 62

Show
Ignore:
Timestamp:
12/07/04 11:43:21 (4 years ago)
Author:
david
Message:

Added that ActiveRecordHelper#form now calls url_for on the :action option.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r58 r62  
    11*SVN* 
     2 
     3* Added that ActiveRecordHelper#form now calls url_for on the :action option. 
    24 
    35* Added all the HTTP methods as alternatives to the generic "process" for functional testing #276 [Tobias Luetke]. Examples: 
  • trunk/actionpack/lib/action_controller/templates/scaffolds/edit.rhtml

    r4 r62  
    11<h1>Editing <%= @scaffold_singular_name %></h1> 
    22 
    3 <%= form(@scaffold_singular_name, :action => "../update" + @scaffold_suffix) %> 
     3<%= form(@scaffold_singular_name, :action => "update" + @scaffold_suffix) %> 
    44 
    55<%= link_to "Show", :action => "show#{@scaffold_suffix}", :id => instance_variable_get("@#{@scaffold_singular_name}").id %> | 
  • trunk/actionpack/lib/action_view/helpers/active_record_helper.rb

    r41 r62  
    2525      # (post is a new record that has a title using VARCHAR and a body using TEXT): 
    2626      #   form("post") => 
    27       #     <form action='create' method='POST'> 
     27      #     <form action='/post/create' method='POST'> 
    2828      #       <p> 
    2929      #         <label for="post_title">Title</label><br /> 
     
    4545      #        Proc.new { |record, column| "#{column.human_name}: #{input(record, column.name)}<br />" }) => 
    4646      # 
    47       #     <form action='sign' method='POST'> 
     47      #     <form action='/post/sign' method='POST'> 
    4848      #       Message: 
    4949      #       <input id="post_title" name="post[title]" size="30" type="text" value="Hello World" /><br /> 
     
    5252      def form(record_name, options = {}) 
    5353        record   = instance_eval("@#{record_name}") 
    54         action   = options[:action] || (record.new_record? ? "create" : "update"
     54        action   = url_for(:action => options[:action] || (record.new_record? ? "create" : "update")
    5555        id_field = record.new_record? ? "" : InstanceTag.new(record_name, "id", self).to_input_field_tag("hidden") 
    5656