You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ruby on Rails: Talk
Howdy.
Is there an easy way to get ActiveRecord to trim/strip spaces off
strings before inserting them into the database?
I can't think of a good reason that one would want trailing spaces to
persist in string database columns. I know I can iterate through all
my class members and strip them before the save, but that seems like
comparatively low level work considering the high level feel of
ActiveRecord. (It makes me suspect there's a better way)
Thanks,
Michael
Oscar Del ben
unread,
Dec 29, 2007, 5:35:18 AM12/29/07
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
Yes you can make it with metaprogramming, but you should see at the active record source and then make a new method that run before a record is created -- Posted via http://www.ruby-forum.com/.