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

Changeset 4375

Show
Ignore:
Timestamp:
05/29/06 00:05:13 (4 years ago)
Author:
david
Message:

Expanded :method option in FormTagHelper#form_tag, FormHelper#form_for, PrototypeHelper#remote_form_for, PrototypeHelper#remote_form_tag, and PrototypeHelper#link_to_remote to allow for verbs other than GET and POST by automatically creating a hidden form field named _method, which will simulate the other verbs over post [DHH]

Files:

Legend:

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

    r4374 r4375  
    11*SVN* 
    22 
    3 * Added :method handling for other verbs to remote_form_tag and remote_form_for [DHH] 
    4  
    5 * Expanded :method option in FormHelper#form_tag to allow for verbs other than GET and POST by automatically creating a hidden form field named _method, which will simulate the other verbs over post [DHH] 
     3* Expanded :method option in FormTagHelper#form_tag, FormHelper#form_for, PrototypeHelper#remote_form_for, PrototypeHelper#remote_form_tag, and PrototypeHelper#link_to_remote to allow for verbs other than GET and POST by automatically creating a hidden form field named _method, which will simulate the other verbs over post [DHH] 
    64 
    75* Added :method option to UrlHelper#link_to, which allows for using other verbs than GET for the link. This replaces the :post option, which is now deprecated. Example: link_to "Destroy", person_url(:id => person), :method => :delete [DHH] 
  • trunk/actionpack/lib/action_view/helpers/javascripts/prototype.js

    r4182 r4375  
    670670    if (parameters.length > 0) parameters += '&_='; 
    671671 
     672    /* Simulate other verbs over post */ 
     673    if (this.options.method != 'get' && this.options.method != 'post') { 
     674      parameters += (parameters.length > 0 ? '&' : '') + '_method=' + this.options.method 
     675      this.options.method = 'post' 
     676    } 
     677 
    672678    try { 
    673679      this.url = url; 
  • trunk/actionpack/lib/action_view/helpers/prototype_helper.rb

    r4374 r4375  
    4040      # DOM object whose id can be specified with <tt>options[:update]</tt>.  
    4141      # Usually, the result would be a partial prepared by the controller with 
    42       # either render_partial or render_partial_collection.  
     42      # render :partial.  
    4343      # 
    4444      # Examples: 
     
    6060      # influence how the target DOM element is updated. It must be one of  
    6161      # <tt>:before</tt>, <tt>:top</tt>, <tt>:bottom</tt>, or <tt>:after</tt>. 
     62      # 
     63      # The method used is by default POST. You can also specify GET or you 
     64      # can simulate PUT or DELETE over POST. All specified with <tt>options[:method]</tt> 
     65      # 
     66      # Example: 
     67      #   link_to_remote "Destroy", person_url(:id => person), :method => :delete 
    6268      # 
    6369      # By default, these remote requests are processed asynchronous during