Jonathan Rochkind wrote:
> Interesting, thanks, lots of tricks there I wouldn'thave figured out for 
> myself. But am I being really inefficient now by calling to_yaml an 
> extra time? I'll call it once to validate, and then throw away the 
> results. Then serialize will call it again when it actually wants to 
> save. Calling it twice for no reason. But I guess to_yaml shouldn't be 
> _that_ expensive?
> 
> Now I wonder if I should abandon the automated serialization altogether, 
> and just handle it myself manually through callbacks. Or maybe I should 
> try monkey-patching the auto-serialization stuff to perform this check 
> itself?

Yeah, the double yaml is a waste, but don't worry about it
unless this is being done sufficiently often to slow down
your app in a way that generates more work or cost.

See if you can come up for a patch for Rails that automatically
adds a such a validation for serialized attributes, where this
validation method and the attributes_with_quotes method that
generates the DB request both draw from a cache of YAMLized
attribute values.

-- 
Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to