rails respond_to and various forms of html responses

Posted by lukewendling on Stack Overflow See other posts from Stack Overflow or by lukewendling
Published on 2010-05-12T15:22:34Z Indexed on 2010/05/12 15:54 UTC
Read the original article Hit count: 162

Filed under:
|
|

I often use

respond_to do |format|
...
end

in Rails for my Restful actions, but I don't know what the ideal solution is for handling various forms of, say, html responses. For instance, view1 that calls action A might expect back html with a list of widgets wrapped in a UL tag, while view2 expects the same list of widgets wrapped in a table. How does one Restfully express that not only do I want back an html formatted response, but I want it wrapped in a table, or in a UL, OL, options, or some other common list-oriented html tag?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about rest