Reputation: 149
IN my index controller I have a query to find all past events which have happened where "when is the date the event has took place
@expired = Location.where('when <= ?', Date.today)
This is my index.html.erb view.
<% @expired.each do |location| %>
<tr>
<td>
<%= location.city %>
</td>
<td><%= location.when %>
</td>
<td><%= location.venue %></td>
<td>
<%= location.start_time %> to <%= location.end_time %>
</td>
<td>General</td>
<td><a href="http://smithridgehc.co.uk/" target="_blank">Smithridge Healthcare</a></td>
</tr>
<% end %>
When I run the server I get this following error:
PG::SyntaxError: ERROR: syntax error at or near "when"
LINE 1: SELECT "locations".* FROM "locations" WHERE (when <= '2015-0...
Could it be due to the wrong formatted date?
Upvotes: 1
Views: 47