Module: TbCore::BelongsToApp::ClassMethods

Defined in:
lib/tb_core/belongs_to_app.rb

Instance Method Summary collapse

Instance Method Details

#belongs_to_app(name, page_title: nil, only: nil) ⇒ Object

Adds a before action to the current controller to act like the specified twice baked app

symbol: This should be the :key value for the app you want to use page_title: Override the base name value for the app (optional) only: An array of controller actions you want this to apply to (optional)



20
21
22
23
24
# File 'lib/tb_core/belongs_to_app.rb', line 20

def belongs_to_app(name, page_title: nil, only: nil)
  before_action ->{
    act_as_app(name, page_title: page_title)
  }, only: only
end

#belongs_to_spud_app(name, options = {}) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/tb_core/belongs_to_app.rb', line 6

def belongs_to_spud_app(name, options={})
  ActiveSupport::Deprecation.warn(
    'ApplicationController#belongs_to_spud_app is deprecated. Please use #belongs_to_app instead.',
    caller
  )
  belongs_to_app(name, page_title: options[:page_title])
end