Module: Saasable::Railties::Helpers

Defined in:
lib/saasable/railties/helpers.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/saasable/railties/helpers.rb', line 5

def self.included(klass)
  klass.extend ClassMethods
  klass.send(:include, InstanceMethods)
  klass.class_eval do
    helper_method :current_saas

    before_action :_redirect_if_saas_not_found unless Rails.env.development?
    saas_not_found_redirect_to '/404.html'

    private

    def _redirect_if_saas_not_found; end

    def _skip_saasable
      current_saas&.deactivate!
    end
  end
end