Skip to content

Instantly share code, notes, and snippets.

@SeanRoberts
Last active April 11, 2016 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SeanRoberts/55581c18fab89fcc8537e3f3ec4f7339 to your computer and use it in GitHub Desktop.
Save SeanRoberts/55581c18fab89fcc8537e3f3ec4f7339 to your computer and use it in GitHub Desktop.
devise_for(
:users,
only: :sessions,
controllers: { sessions: 'devise/sessions' }
)
constraints MainAppConstraint.new do
devise_for(
:users,
skip: :sessions,
controllers: {
registrations: 'registrations',
passwords: 'devise/passwords',
omniauth_callbacks: 'tenon/omniauth_callbacks'
}
)
end
class MainAppConstraint #:nodoc:#
def matches?(request)
subdomain = request.subdomain
!subdomain.present? || protected_subdomains.include?(subdomain)
end
private
def protected_subdomains
%w(
www
admin
ftp
gopher
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment