Does anyone know why there is no respond_to block for generated edit actions? Every other action in typical scaffold controllers has a respond_to block in order to output html and xml formats. Why is the edit action an exception?
I’m using the latest version of Ruby on Rails (2.1.1).
Rails handles the 99% case: It’s fairly unlikely you’d ever need to do any XML or JSON translations in your Edit action, because non-visually, the Edit action is pretty much just like the Show action. Nonvisual clients that want to update a model in your application can call the controller this way
Then, the client app can make any transformations or edits and post (or put) the results to
When you call this, you usually are doing it to get an editable form of the Show action:
And it is intended for human use. 99% of the time, that is. Since it’s unusual to transform the data in the Edit action, Rails assumes you aren’t going to, and DRYs up your code by leaving respond_to out of the scaffold.