You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.
def self.find_matches
repository.adapter.select <<-SQL
select
m.matches_id,
m.begin_date,
m.windows_time_zone,
team1_id,
team2_id,
t1.name as team1,
t2.name as team2,
m.status,
COALESCE(md.name,'') as match_day_name,
s.name as season_name,
r.name as round_name,
c.name as competition_name,
COALESCE(g.name,'') as group_name,
COALESCE(m.use_gsm,'N') as use_gsm,
COALESCE(m.team1_finalscore,0) as team1_score,
COALESCE(m.team2_finalscore,0) as team2_score
from matches m
inner join round r on (r.round_id = m.round_id)
inner join season s on (s.season_id = r.season_id)
inner join competition c on (c.competition_id = s.competition_id)
inner join team t1 on (t1.team_id = m.team1_id)
inner join team t2 on (t2.team_id = m.team2_id)
left outer join match_day md on (m.match_day_id = md.match_day_id)
left outer join groups g on (r.round_id = g.round_id)
where m.begin_date <= (CURDATE() + interval 1 day)
and m.begin_date >= (CURDATE() - interval 1 day)
order by m.begin_date desc
SQL
end
end
`
Calling Match.find_matches from the console returns an array of
structs like the following:
I have a model defined as follows:
`
class Match
include DataMapper::Resource
storage_names[:default] = 'matches'
property :id, Serial, :field => 'matches_id', :required => true
def self.find_matches
repository.adapter.select <<-SQL
select
m.matches_id,
m.begin_date,
m.windows_time_zone,
team1_id,
team2_id,
t1.name as team1,
t2.name as team2,
m.status,
COALESCE(md.name,'') as match_day_name,
s.name as season_name,
r.name as round_name,
c.name as competition_name,
COALESCE(g.name,'') as group_name,
COALESCE(m.use_gsm,'N') as use_gsm,
COALESCE(m.team1_finalscore,0) as team1_score,
COALESCE(m.team2_finalscore,0) as team2_score
from matches m
inner join round r on (r.round_id = m.round_id)
inner join season s on (s.season_id = r.season_id)
inner join competition c on (c.competition_id = s.competition_id)
inner join team t1 on (t1.team_id = m.team1_id)
inner join team t2 on (t2.team_id = m.team2_id)
left outer join match_day md on (m.match_day_id = md.match_day_id)
left outer join groups g on (r.round_id = g.round_id)
where m.begin_date <= (CURDATE() + interval 1 day)
and m.begin_date >= (CURDATE() - interval 1 day)
order by m.begin_date desc
SQL
end
end
`
Calling Match.find_matches from the console returns an array of
structs like the following:
#<struct matches_id=54235, begin_date=Sun, 28 Nov 2010 00:00:00 -0500, windows_time_zone="Morocco Standard Time", team1_id=937, team2_id=943, team1="Deportes Tolima", team2="La Equidad", status="N", match_day_name="Cuadrangular Semifinal Fecha 3", season_name="Finalizacion 2010", round_name="Cuadrangular Semifinal", competition_name="Liga Postobon - Colombia", group_name="", use_gsm="N", team1_score=0, team2_score=0>
It appears that to_json is choking on the begin_date format. Is there
anything I can do to correct this? I'm using MySQL 5.1 if that helps.
The text was updated successfully, but these errors were encountered: