It looks to me like you can subtract one date var from another & get a Rational that represents the number of days difference. You should be able to .to_i that to work w/it as a number.
HTH, -Roy -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Neil Funk Sent: Monday, October 06, 2008 6:15 PM To: [email protected] Subject: [Rails] Re: How call distance_of_time_in_words() from controller? RSL ___ wrote: > distance_of_time_in_words is purely a view concern because it's about > output which is the view. Thanks, Dan and RSL. I think Pete might have been asking because of the same problem I am having right now: I know what MVC is, but I just can't for the life of me figure out how to subtract 2 dates! I'm pulling at straws here to find any hack that might work and this distance_of_time_in_words() is the closest I've gotten. I have 2 fields in an ActiveRecord model, due:date and complete:date, that I'm trying to find the elapsed time between. I'd think this is just a simple matter of subtraction, but apparently not. I have a strong background in C and Java and Python, but just recently got into Ruby (from Rails). All I'm trying to do is subtract these 2 fields for every instance of the model. This should be the simplest thing ever, but I'm missing something. Could someone please please clue me in? Thanks. -Neil -- 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 [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

