Hello,
I have a script that parses a CSV during POST and pops the data into my
MySQL db. It works great, but I want to edit some info from the CSV
before I put it into the DB. In my case, I need to strip off the leading
number off of strings are 11 characters in length. I was recommended
that I do this in the model... I''m not exactly sure how to do this...
What I have is this in my model:
class Bes < ActiveRecord::Base
def besnumber
if bes.bes_phonenumber.to_s.size == 11
bes.bes_phonenumber = bes.bes_phonenumber.to_s.slice(1..11)
end
end
end
However, after I upload it and check the database, the numbers haven''t
been cut. How exactly does this MVC work? I mean, does it go from the
index view to the model then to the controller? Wouldn''t I then want to
put this in the controller? I am very new to RoR and any help is
appreciated!
Thanks,
- Jeff Miller
--
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
-~----------~----~----~----~------~----~------~--~---