How to globally PREVENT json rendering in rails? -


i have rails application in of actions respond json.

is there "switch" can turn off prevent controllers responding json despite respond_to method call, or still have disable manually in every action (which seems odd).

i have proposal, though bit hacky i'm afraid :)

class < applicationcontroller   before_filter :disable_json    def disable_json     if request.format =~ /json/       //do like, redirect_to or reply message     end   end 

the before_filter fired before specific controller's method.

the json header "application/json"

for request, can read more here: http://guides.rubyonrails.org/action_controller_overview.html#the-request-object


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -