lib/rails-settings/settings.rb in rails-settings-cached-0.3.2 vs lib/rails-settings/settings.rb in rails-settings-cached-0.4.0
- old
+ new
@@ -30,19 +30,20 @@
end
#destroy the specified settings record
def self.destroy(var_name)
var_name = var_name.to_s
- if self.all.key?(var_name)
- object(var_name).destroy
+ obj = object(var_name)
+ unless obj.nil?
+ obj.destroy
true
else
raise SettingNotFound, "Setting variable \"#{var_name}\" not found"
end
end
#retrieve all settings as a hash (optionally starting with a given namespace)
- def self.all(starting_with = nil)
+ def self.get_all(starting_with = nil)
vars = thing_scoped.select("var,value")
if starting_with
vars = vars.where("var LIKE '#{starting_with}%'")
end