converting created_at to the number of days ago format


I want to display the created_at field of my model in the format n days ago n hours ago

Please help me in this

@seconds_from_model_creation = ( - (@model.created_at).to_i) @days_from_creation = @seconds_from_model_creation / (60*60*24) ...

Sorry, that should be ( -

and there are questions about timezones and stuff. You need to watch it carefully.