A calendar management project, for events and activities related to communities fighting for freedoms.
This can be related to software, art, data, hardware, content, commons, internet.
https://www.agendadulibre.org
This can be related to software, art, data, hardware, content, commons, internet.
https://www.agendadulibre.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
516 B
18 lines
516 B
class Event < ActiveRecord::Base |
|
belongs_to :region, foreign_key: 'region' |
|
|
|
scope :year, -> year { |
|
where "end_time >= ? and start_time < ?", |
|
"#{year}-1-1", "#{year.to_i+1}-1-1" |
|
} |
|
scope :month, -> year, month { |
|
where "end_time >= ? and start_time < ?", |
|
"#{year}-#{month.to_i-1}-1", "#{year}-#{month.to_i+2}-1" |
|
} |
|
scope :region, -> region { where region: region } |
|
scope :tag, -> tag { where "tags like ?", "%#{tag}%" } |
|
|
|
def same_day? |
|
start_time.to_date == end_time.to_date |
|
end |
|
end
|
|
|