Steve V
unread,Sep 30, 2011, 5:23:13 PM9/30/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Mongoid
Is there any way to alter attribute values sent to find_or_create_by,
or where clauses all the time? I have some values that are always in a
specific format, but depending on the datasource they are coming in
from, they can be represented differenty. Some have something
prepended to them, others have differing case. Rather than try to make
sure I catch every instance for all time, I am hoping there's a way to
just do it on the model.
Model.where username: 'prefix\somename'
or
Model.find_or_create_by username: 'a.somename'
would both be modified so that they would just be {username:
'somename'}
Thanks,
Steve