mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Merge pull request #3328 from stephenbaldwin/master
Ability to load modules in specific order
This commit is contained in:
commit
d3d9fba201
1 changed files with 5 additions and 2 deletions
|
@ -348,6 +348,7 @@ module Devise
|
|||
# +controller+ - Symbol representing the name of an existing or custom *controller* for this module.
|
||||
# +route+ - Symbol representing the named *route* helper for this module.
|
||||
# +strategy+ - Symbol representing if this module got a custom *strategy*.
|
||||
# +insert_at+ - Integer representing the order in which this module's model will be included
|
||||
#
|
||||
# All values, except :model, accept also a boolean and will have the same name as the given module
|
||||
# name.
|
||||
|
@ -357,10 +358,12 @@ module Devise
|
|||
# Devise.add_module(:party_module)
|
||||
# Devise.add_module(:party_module, strategy: true, controller: :sessions)
|
||||
# Devise.add_module(:party_module, model: 'party_module/model')
|
||||
# Devise.add_module(:party_module, insert_at: 0)
|
||||
#
|
||||
def self.add_module(module_name, options = {})
|
||||
ALL << module_name
|
||||
options.assert_valid_keys(:strategy, :model, :controller, :route, :no_input)
|
||||
options.assert_valid_keys(:strategy, :model, :controller, :route, :no_input, :insert_at)
|
||||
|
||||
ALL.insert (options[:insert_at] || -1), module_name
|
||||
|
||||
if strategy = options[:strategy]
|
||||
strategy = (strategy == true ? module_name : strategy)
|
||||
|
|
Loading…
Reference in a new issue