Module: ActiveScaffold::DelayedSetup::ClassMethods
- Defined in:
- lib/active_scaffold/delayed_setup.rb
Instance Method Summary collapse
- #active_scaffold(model_id = nil, &block) ⇒ Object
- #active_scaffold_config ⇒ Object
- #config_active_scaffold_delayed ⇒ Object
Instance Method Details
#active_scaffold(model_id = nil, &block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/active_scaffold/delayed_setup.rb', line 13 def active_scaffold(model_id = nil, &block) @delayed_monitor ||= Monitor.new @active_scaffold_delayed = proc do begin @_prefixes = nil # clean prefixes in case is already cached, so our local_prefixes override is picked up super(model_id, &block) @active_scaffold_delayed = @delayed_monitor = nil # after configuring, no need to keep proc or monitor rescue StandardError # clear config variable if failed, so next request tries again @active_scaffold_config = nil raise end end end |
#active_scaffold_config ⇒ Object
35 36 37 38 |
# File 'lib/active_scaffold/delayed_setup.rb', line 35 def active_scaffold_config config_active_scaffold_delayed super end |
#config_active_scaffold_delayed ⇒ Object
28 29 30 31 32 33 |
# File 'lib/active_scaffold/delayed_setup.rb', line 28 def config_active_scaffold_delayed @delayed_monitor&.synchronize do # if called in same thread while running config, do nothing @active_scaffold_delayed&.call unless @active_scaffold_config end end |