Matthew Rudy 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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---