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)



16
17
18
19
20
# File 'lib/tb_core/belongs_to_app.rb', line 16

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



5
6
7
8
# File 'lib/tb_core/belongs_to_app.rb', line 5

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