I have a Rails 3 App that has needs some user defined settings. I would like to use this https://github.com/ledermann/rails-settings plugin. I have it working in the rails
What I did is add dynamic setters/getters to my User class as such
class User < ActiveRecord::Base
has_settings
def self.settings_attr_accessor(*args)
args.each do |method_name|
eval "
def #{method_name}
self.settings.send(:#{method_name})
end
def #{method_name}=(value)
self.settings.send(:#{method_name}=, value)
end
"
end
end
settings_attr_accessor :color, :currency, :time_zone
end
With that, you can use "color" just like any other attribute of your User model. Also it's very simple to add more settings, just add them to the list