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

Changeset 123

Show
Ignore:
Timestamp:
12/12/04 13:48:58 (4 years ago)
Author:
david
Message:

Fixed the default button name on forms generated with form

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_view/helpers/active_record_helper.rb

    r114 r123  
    5252      def form(record_name, options = {}) 
    5353        record   = instance_eval("@#{record_name}") 
    54         action   = url_for(:action => options[:action] || (record.new_record? ? "create" : "update")) 
    55         submit_value = options[:submit_value] || action.gsub(/[^\w]/, '').capitalize 
     54 
     55        options[:action] ||= record.new_record? ? "create" : "update" 
     56        action   = url_for(:action => options[:action]) 
     57 
     58        submit_value = options[:submit_value] || options[:action].gsub(/[^\w]/, '').capitalize 
    5659         
    5760        id_field = record.new_record? ? "" : InstanceTag.new(record_name, "id", self).to_input_field_tag("hidden") 
    5861         
    59         %(<form action="#{action}" method="POST">#{id_field}) + 
     62        %(<form action="#{action}" method="post">#{id_field}) + 
    6063          all_input_tags(record, record_name, options) + 
    6164          %(<input type="submit" value="#{submit_value}" /></form>)