Paste: Helper prints Object ID

Author: dokshor
Mode: ruby
Date: Thu, 2 Jul 2009 14:51:41
Plain Text |
# Array Contains
--- 
- :room_id: 10
  :check_in: 2009-06-30
  :check_out: 2009-07-01
- :room_id: 7
  :check_in: 2009-06-30
  :check_out: 2009-07-03
- :room_id: 10
  :check_in: 2009-07-10
  :check_out: 2009-07-13

# Helper contains

module BookingsHelper

  def check_date(used_days_object,room_id)

      if !used_days_object.nil?
      
        used_days_object.each do |ud|

          if ud[:room_id] == room_id
              if ud[:check_in] - @date_temporal >=0  || ud[:check_out] - @date_temporal >=0
                'class="reserved"'
              end
          end

        end # enforeach"


      end

  end
  
end

# In the view
<td <%=  check_date(@used_days_object, room.id) %>>

New Annotation

Summary:
Author:
Mode:
Body: