On 10/25/07, Rick Olson <[EMAIL PROTECTED]> wrote:
>
>
> Allright, we've been going back and forth on
> http://dev.rubyonrails.org/ticket/9935, and I'd like to get some more
> comments, primarily from folks using or implementing JSON rest APIs.
> I personally haven't, because I tend to get a lot of pushback from
> other JSON fans regarding things like this, date formats, etc.
>
> The goal with the Rails param parsers is to allow the same controller
> code to work with multiple formats (html forms, xml, json, yaml, etc).
> Also, going with REST best practices would be nice too. This
> question is what kept me from implementing this months ago, actually.
The last patch submitted against the ticket allows you to do this:
def show
respond_to do |format|
format.xml { render :xml=>@item }
format.json { render :json=>@item }
end
end
def update
@item.update_attributes! params[:item]
end
It works for both XML and JSON (also HTML forms, not shown here), and you
can feed update the same result you got from the previous show, retaining
the PUT-what-you-GET.
Assaf
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---