Module: Passwordless::RouterHelpers
- Defined in:
- lib/passwordless/router_helpers.rb
Overview
Helpers for generating passwordless routes.
Instance Method Summary collapse
-
#passwordless_for(resource, at: nil, as: nil) ⇒ Object
Generates passwordless routes for a given Model Example usage: passwordless_for :users # or with options …
Instance Method Details
#passwordless_for(resource, at: nil, as: nil) ⇒ Object
Generates passwordless routes for a given Model
Example usage:
passwordless_for :users
# or with options ...
passwordless_for :users, at: 'session_stuff', as: :user_session_things
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/passwordless/router_helpers.rb', line 19 def passwordless_for(resource, at: nil, as: nil) mount_at = at || resource.to_s mount_as = as || resource.to_s mount( Passwordless::Engine, at: mount_at, as: mount_as, defaults: {authenticatable: resource.to_s.singularize} ) Passwordless.mounted_as = mount_as end |