Module: Golden::Setting::Resourced::ClassMethods

Defined in:
app/models/concerns/golden/setting/resourced.rb

Instance Method Summary collapse

Instance Method Details

#with_settingsObject



9
10
11
12
# File 'app/models/concerns/golden/setting/resourced.rb', line 9

def with_settings
  select("DISTINCT #{self.table_name}.*").
  joins("JOIN `#{settings_table}` ON (#{join_settings_on})")
end

#with_settings_for(name) ⇒ Object



14
15
16
17
# File 'app/models/concerns/golden/setting/resourced.rb', line 14

def with_settings_for name
  joins("JOIN `#{settings_table}` ON (#{join_settings_on})").
  where("`#{settings_table}`.name = ?", name)
end

#without_settingsObject



19
20
21
22
# File 'app/models/concerns/golden/setting/resourced.rb', line 19

def without_settings
  joins("LEFT JOIN `#{settings_table}` ON (#{join_settings_on})").
  where("`#{settings_table}`.id IS NULL")
end

#without_settings_for(name) ⇒ Object



24
25
26
27
# File 'app/models/concerns/golden/setting/resourced.rb', line 24

def without_settings_for name
  without_settings.
  where("`#{settings_table}`.name = ?", name)
end