Sha256: 90a974b411b8d672c9f660058604b408a6f6feac8b5c6c1727a09dd01b61dc9e

Contents?: true

Size: 405 Bytes

Versions: 3

Compression:

Stored size: 405 Bytes

Contents

class Task < ActiveRecord::Base
  belongs_to :project
  belongs_to :location
  belongs_to :user
  
  default_fxml_methods :is_active
  
  def is_active
    case
    when start_time && end_time 
      (start_time .. end_time) === Time.now
    when start_time && end_time.nil?
      start_time <= Time.now
    when start_time.nil && end_time
      end_time >= Time.now
    else
      true
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruboss4ruby-1.0.3 test/models/task.rb
ruboss4ruby-1.0.5 test/models/task.rb
ruboss4ruby-1.0.4 test/models/task.rb