In one of my rails controller, I must respond to several types of formats, so I use the typical respond_to
chain:
respond_to do |format|
format.html { ... }
format.mobile { ... }
format.jpg { ... }
format.xml { ... }
format.js { ... }
end
Usually that the { ... }
part is repeated on several formats. What is the best way to stay DRY on this case? On an scenario in which html
, mobile
and xml
have a "repeated" action, I'd like to do something like this:
respond_to do |format|
format[:html, :mobile, :xml] { ... }
format.jpg { ... }
format.js { ... }
end
Thanks a lot.