lib/rails-settings/settings.rb in rails-settings-cached-0.6.1 vs lib/rails-settings/settings.rb in rails-settings-cached-0.6.2
- old
+ new
@@ -102,18 +102,24 @@
new_value
end
def object(var_name)
- table_exists? && thing_scoped.where(var: var_name.to_s).first
+ return nil unless rails_initialized?
+ return nil unless table_exists?
+ thing_scoped.where(var: var_name.to_s).first
end
def thing_scoped
unscoped.where('thing_type is NULL and thing_id is NULL')
end
def source(filename)
Default.source(filename)
+ end
+
+ def rails_initialized?
+ Rails.application && Rails.application.initialized?
end
end
end
end