ActsAsConfigurable?


#1

Hi there,
does anyone kow of an existing “ActsAsConfigurable” type plugin?

I want to say;

class Organisation
acts_as_configurable :properties => {
:some_property => {:type => :boolean, :default => false}
}
end

and then configure it by;

organisation.config_for(:some_property) # => false # the default
organisation.set_config_for(:some_property, true)

rather than cluttering up all of my tables with boolean flags.

If not, then I’m going to build it anyway.
So let me know if you’re interested.

Matthew R. Jacobs


#2

Matthew R. Jacobs wrote:

Hi there,
does anyone kow of an existing “ActsAsConfigurable” type plugin?

This is what I came up with;

class Organisation < ActiveRecord::Base
acts_as_configurable :some_property => {
:default => “left”,
:options => [“left”, “middle”, “right”],
:description => “Where should we put something?”}
end

then just;

organisation.some_property # uses the default if it has not been set
organisation.some_property = “middle”

http://github.com/matthewrudy/acts_as_configurable

Will add support for Boolean attributes some time soon.

http://blog.matthewrudy.com