Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/two_factor_auth.rb

Instance Method Summary collapse

Instance Method Details

#two_factor_auth_for(resource) ⇒ Object



142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/two_factor_auth.rb', line 142

def two_factor_auth_for resource
  begin
    klass = resource.to_s.classify.constantize
  rescue NameError
    warn "You included two_factor_auth_for #{resource.inspect} in your routes but there is no model defined in your system"
  end
  namespace :two_factor_auth do
    resources(:registrations,   only: [:new, :create])
    resource(:authentication,   only: [:new, :create])
    resources(:trusted_facets,  only: [:index])
  end
end