> I have a list with bookings from a user, where i want show which books
> he had lend from which category and show the difference between the end
> and the start-date (not in words, mayby in days or hours). Around this
> list i have an each do loop.
> Now i have found different examples to create a method to get the
> date difference, but i don“t know HOW i have to implent it in my
> application, WHERE this method has to stand (in the Model or the
> controller?) and how it has to look in the view.
>

Personally, I'd have 2 methods here: a booking_length method on your
model (which sounds like it it just needs to compute the difference
between those 2 columns) and a view helper (say display_booking_length
that calls that method and turns the returned number into a user
readable string.

Your view just needs to do

<%= display_booking_length booking %>

fred

> thanks for your help!
>
> --
> Posted viahttp://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.

Reply via email to