I need to build an array that contains lots of date objects.

I've got a booking model and it contains stuff like this...


  create_table "bookings", :force => true do |t|
    t.string   "firstname"
    t.string   "lastname"
    t.integer  "number_of_people"
    t.integer  "deposit"
    t.integer  "price"
    t.integer  "days"
    t.datetime "from"
    t.datetime "to"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

SOO - each booking starts on a date and finishes on a date...

I need to collect up all the booking dates in an array so that I can do
stuff with them...

I figure i need a method in my model to do it...

something like

  def self.all_booking_dates

    find(:all);  # first off find all the booking records

    @BookedDays = ( XXX ).map # do something here to create an array
with all the dates in, maybe I need a loop  ... sorry bit stuck?

  end

be grateful for any tips.

thanks...
-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to