diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-12 13:48:58 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-12-12 13:48:58 +0000 |
commit | 19c62a7ee917676674e01f24ce39e59d4f8c7aa2 (patch) | |
tree | f1076515c70353e65205bbd0d8073f18a09c449f /actionpack | |
parent | 204100d772d6a71235730c19306189761bfed9fe (diff) | |
download | rails-19c62a7ee917676674e01f24ce39e59d4f8c7aa2.tar.gz rails-19c62a7ee917676674e01f24ce39e59d4f8c7aa2.tar.bz2 rails-19c62a7ee917676674e01f24ce39e59d4f8c7aa2.zip |
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
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/helpers/active_record_helper.rb | 9 |
1 files 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 # </form> 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") - %(<form action="#{action}" method="POST">#{id_field}) + + %(<form action="#{action}" method="post">#{id_field}) + all_input_tags(record, record_name, options) + %(<input type="submit" value="#{submit_value}" /></form>) end |