2

Consider the following code:

respond_to do |format|
  format.js  { render :layout => false }
  format.xml { head :ok }
end

Now I know you can specify a whole bunch of formats, but is there a way to specify all other formats (in this case other than .jx and .xml) to save me from having to specify every specific format explicitly?

I guess I kind of want an "if-else" type condition. Is this possible with respond_to do |format|?

Ash
  • 24,276
  • 34
  • 107
  • 152
  • I would call this post a duplicate of: http://stackoverflow.com/questions/1671111/methods-for-limiting-the-rails-render-format-to-html/2470191#2470191 (because the required answer is in there) – Zabba Mar 24 '11 at 23:03

1 Answers1

3

Good answer for you here: Can Ruby on Rails's respond_to return a line when the format is not supported? although they posed their question differently.
hth
Perry

Community
  • 1
  • 1
Perry Horwich
  • 2,798
  • 3
  • 23
  • 51