Skip to content

Instantly share code, notes, and snippets.

@typeoneerror
Created September 13, 2011 22:54
Show Gist options
  • Select an option

  • Save typeoneerror/1215406 to your computer and use it in GitHub Desktop.

Select an option

Save typeoneerror/1215406 to your computer and use it in GitHub Desktop.
ssl route constraint
# config/routes.rb
AppName::Application.routes.draw do
# API routing with versioned namespace
scope :constraints => AppName::Ssl do
namespace :api do
namespace :v1 do
# routes here
end
end
end
end
# lib/app_name/ssl.rb
module AppName
class Ssl
def self.matches?(request)
return true if Rails.env.development?
request.ssl?
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment