routes - Rails Routing - Reject any/all extensions? -
i want make request /session/update , return json response. have working right following route:
get 'session/update', to: 'user_sessions#keep_alive'
however, route allows requests have type of extension tacked on end of (/session/update.txt, /session/update.abc123, etc.). how can write route rejects request includes extension? want lock down responds /session/update.
you can constraints below
scope :format => true, :constraints => { :format => 'json' } 'session/update', to: 'user_sessions#keep_alive' end
Comments
Post a Comment