Editing POST info before adding to the DB

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 M.

nevermind, I got it done inside the controller. Thanks anyway!