How to convert a date in a model?

Uhm, correct me if i'm wrong, cos i'm all new to RoR + Ruby itself, but i think you could add a method to your usermodel that converts the date, like this:

class BlaBla < ActiveRecord::Base ... ... def price_to_start_on_convdate self.price_to_start_on.strftime("%Y%m%d") #or like this? gotta learn proper Ruby, damn :smiley:   return self.price_to_start_on.strftime("%Y%m%d") end

end

Is it correct to put that kind of thing in the model? I did that before with a date format - like Object#displaydate, and I was told that it was bad form - I should put it in a helper instead. Any thoughts on this?

Andrew Cleland wrote:

i don't really think there is a "wrong" or "right" for questions like this, it mainly is a matter of taste.

both solutions would be DRY in my opinion, the model-way adds a method to your object while a helper would be something like this:

<%= display_date(@yourobject.date) %>