From 19c62a7ee917676674e01f24ce39e59d4f8c7aa2 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 12 Dec 2004 13:48:58 +0000 Subject: Fixed the default button name on forms generated with form git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@123 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/active_record_helper.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/actionpack/lib/action_view/helpers/active_record_helper.rb b/actionpack/lib/action_view/helpers/active_record_helper.rb index 4f7d66d8f7..a2b5a8b004 100644 --- a/actionpack/lib/action_view/helpers/active_record_helper.rb +++ b/actionpack/lib/action_view/helpers/active_record_helper.rb @@ -51,12 +51,15 @@ module ActionView # def form(record_name, options = {}) record = instance_eval("@#{record_name}") - action = url_for(:action => options[:action] || (record.new_record? ? "create" : "update")) - submit_value = options[:submit_value] || action.gsub(/[^\w]/, '').capitalize + + options[:action] ||= record.new_record? ? "create" : "update" + action = url_for(:action => options[:action]) + + submit_value = options[:submit_value] || options[:action].gsub(/[^\w]/, '').capitalize id_field = record.new_record? ? "" : InstanceTag.new(record_name, "id", self).to_input_field_tag("hidden") - %(
#{id_field}) + + %(#{id_field}) + all_input_tags(record, record_name, options) + %(
) end -- cgit v1.2.3