Module: HubriseApp::ApplicationController::AppInstanceMethods

Extended by:
ActiveSupport::Concern
Included in:
HubriseApp::ApplicationController
Defined in:
app/controllers/hubrise_app/application_controller/app_instance_methods.rb

Instance Method Summary collapse

Instance Method Details

#current_app_instanceObject



14
15
16
17
18
19
# File 'app/controllers/hubrise_app/application_controller/app_instance_methods.rb', line 14

def current_app_instance
  if current_user
    @app_instance ||= HubriseApp::Services::ResolveAppInstance.run(current_user.app_instances, hr_app_instance_id,
                                                                   self)
  end
end

#default_url_optionsObject



29
30
31
# File 'app/controllers/hubrise_app/application_controller/app_instance_methods.rb', line 29

def default_url_options
  super.merge(app_instance_id: hr_app_instance_id || current_app_instance&.hr_id)
end

#ensure_app_instance_found!Object



21
22
23
24
25
26
27
# File 'app/controllers/hubrise_app/application_controller/app_instance_methods.rb', line 21

def ensure_app_instance_found!
  if hr_app_instance_id.blank?
    render(plain: "Something went wrong. Please try to reopen from Hubrise Dashboard.")
  elsif current_app_instance.nil?
    redirect_to(build_hubrise_oauth_authorize_url, allow_other_host: true)
  end
end

#hr_app_instance_idObject



10
11
12
# File 'app/controllers/hubrise_app/application_controller/app_instance_methods.rb', line 10

def hr_app_instance_id
  params[:app_instance_id]
end