I can use this also @credit_card = CreditCard.new(params[:credit_card])
But I don’t want it. I want to store “expiry_date” using Date.civil or
Date.civil_to_jd
why not let activerecord do the hard work for you ? Anywway, the
problem here is that you need to turn those strings into integers
before giving them to Date.civil.
Let active record do the work for you. Put in a
before_validation_on_create (or update or whatever) hook in your model
and do the changes you want. Also, isn’t Date.civil the same as the
normal date convention we use?
I can use this also @credit_card = CreditCard.new(params[:credit_card])
But I don’t want it. I want to store “expiry_date” using Date.civil or
Date.civil_to_jd
why not let activerecord do the hard work for you ? Anywway, the
problem here is that you need to turn those strings into integers
before giving them to Date.civil.
Fred
Thanks Fred, i didn’t use to_i method to convert string to integer.