I think that''s actually pretty neat. I can think of a few uses for that
already.
On 6/5/06, Michael Daines <michael.daines@gmail.com>
wrote:> I''m releasing a very small plugin that allows you to specify
default
> values for fields in models. Ordinarily, you might do this in your
> schema, I guess, but then it''s awkward if you need that on a
> serialized field or need your default values calculated somehow.
>
> So you can do something like this: (repeated from an earlier post and
> the README)
>
> class Mixture < ActiveRecord::Base
> serialize :color
> default_value :color, [255, 0, 0]
> end
>
> m = Mixture.new
> m.color # => [255,0,0]
>
> Here''s the README:
>
> http://mdaines.com/svn/plugins/default_value/trunk/README
>
> To install: (as usual)
>
> script/plugin install http://mdaines.com/svn/plugins/default_value/
> trunk
>
>
> Thoughts, comments?
>
>
> --
> Michael Daines
> http://www.mdaines.com
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>