-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global Settings #60
Comments
+1 |
+1 this would be an excellent addition |
+1, that's what the original "rails-settings" was all about. |
+1 |
FWIW: We ended up just doing a CREATE TABLE global_settings (
id integer NOT NULL,
var character varying(255) NOT NULL,
value text,
thing_id integer,
thing_type character varying(30),
created_at timestamp without time zone,
updated_at timestamp without time zone
); class GlobalSetting < ActiveRecord::Base
attr_accessible :var,
:value,
:thing_id,
:thing_type,
:created_at,
:updated_at
serialize :value
end
class GlobalSettings
def self.get(name)
setting = GlobalSetting.find_by(var: name)
setting && setting.value
end
end #
class V1::SettingsController < ActionController::Base
# ...
def defaults
render :text => GlobalSettings.get(:ios_settings)
end
end |
This is awesome, thanks for coming through on this! |
A fork of this repo: https://github.com/huacnlee/rails-settings-cached implements it. See: https://github.com/huacnlee/rails-settings-cached#usage |
+1 |
1 similar comment
+1 |
+1 |
I know I'm late to the party, but if anyone is looking to restore that global https://gist.github.com/jimryan/1ff3d6a19f9ec1abd6612864a05e3185 |
+1 |
Hi,
Is there anyway you could show usage for global settings?
I don't want settings stored on the instance level but on some something like:
FooSettings.time_stamp = DateTime.now
I only ever want a single FooSettings instance.
Thanks!
The text was updated successfully, but these errors were encountered: