Forum: Ruby on Rails ActsAsConfigurable?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Matthew Rudy J. (Guest)
on 2008-10-06 14:53
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
http://blog.matthewrudy.com
Matthew Rudy J. (Guest)
on 2008-10-06 18:36
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
This topic is locked and can not be replied to.