I need to do API version checks and so I've implemented a check in my controller method like:
if request.header["api_version"] != 1
respond_to do |format|
format.json {render :json => expiredMessage}
end
return
end
Works fine, I'm returning in the control statement so Rails doesn't complain about double render. I tried to DRY these up into an application controller method as a before_filter, but then I get the multiple renders complaint from Rails. It seems that the scope has changed such that the 'return' in the control statement no longer returns from the original controller method?
I'm wondering how I can do a render from the application controller method, or if there's a better way how can I implement this functionality? Thanks!