EmmanuelOga
2008-Jan-17 16:25 UTC
Verifiers for Ticket #10537 ([PATCH][TINY] ActiveResource in 2.0.x do not define "new_record?" Fixes form_for issue with ARes)
Can you verify tinny http://dev.rubyonrails.org/ticket/10537 ?
This is important not only for users wanting to replace ActiveRecords
with ActiveResources, but also for compatibility with form_for on
rails. See, when doing something like:
# new.rhtml
<% form_for(@article) do |f| %>
...
form_for method behaves like this:
# action_view/helpers/form_helpers.rb
def form_for(record_or_name_or_array, *args, &proc)
... apply_form_for_options!([object], options)
and then:
def apply_form_for_options!(object_or_array, options) #:nodoc:
... if object.respond_to?(:new_record?) && object.new_record?
... assignation of "post" HTTP method to the form
If new_record? is not present on the ActiveResource and it is used
with form_for, then the form will be created for an *update* of the
resource (i.e. hidden input will be created with value "put") and not
for what we need: the creation of the res (method "post", no hidden
input).
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---
EmmanuelOga
2008-Jan-17 16:25 UTC
Verifiers for Ticket #10537 ([PATCH][TINY] ActiveResource in 2.0.x do not define "new_record?" Fixes form_for issue with ARes)
Can you verify tinny http://dev.rubyonrails.org/ticket/10537 ?
This is important not only for users wanting to replace ActiveRecords
with ActiveResources, but also for compatibility with form_for on
rails. See, when doing something like:
# new.rhtml
<% form_for(@article) do |f| %>
...
form_for method behaves like this:
# action_view/helpers/form_helpers.rb
def form_for(record_or_name_or_array, *args, &proc)
... apply_form_for_options!([object], options)
and then:
def apply_form_for_options!(object_or_array, options) #:nodoc:
... if object.respond_to?(:new_record?) && object.new_record?
... assignation of "post" HTTP method to the form
If new_record? is not present on the ActiveResource and it is used
with form_for, then the form will be created for an *update* of the
resource (i.e. hidden input will be created with value "put") and not
for what we need: the creation of the res (method "post", no hidden
input).
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---