Module: CompanyScope::Filter::FilterClassMethods
- Defined in:
- lib/company_scope/filter.rb
Instance Method Summary collapse
- #acts_as_company_filter ⇒ Object
- #company_setup ⇒ Object
-
#set_scoping_class(scope_model = :company) ⇒ Object
-
the default is set by the Rails application configuration!.
-
Instance Method Details
#acts_as_company_filter ⇒ Object
51 52 53 |
# File 'lib/company_scope/filter.rb', line 51 def acts_as_company_filter around_filter :filter_by_current_company_scope end |
#company_setup ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/company_scope/filter.rb', line 43 def company_setup if CompanyScope.config.enabled helper_method :current_company #set_scoping_class Rails.application.config.company_scope[:company_model] set_scoping_class CompanyScope.config.company_model end end |
#set_scoping_class(scope_model = :company) ⇒ Object
-
the default is set by the Rails application configuration!
34 35 36 37 38 39 40 41 |
# File 'lib/company_scope/filter.rb', line 34 def set_scoping_class(scope_model = :company) if CompanyScope.config.enabled self.class_eval do cattr_accessor :scope_class end self.scope_class = scope_model.to_s.camelcase.constantize end end |