Module: Katello::Concerns::LocationExtensions
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/katello/concerns/location_extensions.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #assert_deletable ⇒ Object
- #associate_default_http_proxy ⇒ Object
- #deletable? ⇒ Boolean
- #reset_settings ⇒ Object
- #set_default_overrides ⇒ Object
Instance Method Details
#assert_deletable ⇒ Object
26 27 28 |
# File 'app/models/katello/concerns/location_extensions.rb', line 26 def assert_deletable throw :abort unless deletable? end |
#associate_default_http_proxy ⇒ Object
49 50 51 52 53 54 |
# File 'app/models/katello/concerns/location_extensions.rb', line 49 def associate_default_http_proxy if (default_proxy = ::HttpProxy.default_global_content_proxy) default_proxy.locations << self default_proxy.save end end |
#deletable? ⇒ Boolean
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/models/katello/concerns/location_extensions.rb', line 30 def deletable? if ::Location.unscoped.count == 1 errors.add( :base, _('Cannot delete the last Location.')) false elsif title == ::Setting[:default_location_subscribed_hosts] errors.add( :base, _('Cannot delete the default Location for subscribed hosts. If you '\ 'no longer want this Location, change the default Location for '\ 'subscribed hosts under Administer > Settings, tab Content.') ) false else true end end |
#reset_settings ⇒ Object
18 19 20 21 22 23 24 |
# File 'app/models/katello/concerns/location_extensions.rb', line 18 def reset_settings if saved_change_to_attribute?(:title) if ::Setting[:default_location_subscribed_hosts] == self.title_before_last_save ::Setting[:default_location_subscribed_hosts] = self.title end end end |
#set_default_overrides ⇒ Object
13 14 15 16 |
# File 'app/models/katello/concerns/location_extensions.rb', line 13 def set_default_overrides self.ignore_types << ::ProvisioningTemplate.name self.ignore_types << ::Hostgroup.name end |