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



157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/two_factor_auth.rb', line 157

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