I've just deployed my first app on Heroku with Postgres and I'm getting an error when querying data to the models. It's been working properly with local MySQL database when the app queries this through the controller:
SELECT "locations".*
FROM "locations"
WHERE (id LIKE '%1%' OR user_id LIKE '%1%')):
18: </thead>
19:
20: <tbody>
21: <% @locations.each do |location| %>
22: <tr>
23: <td><%= location.id %></td>
24: <td><%= location.user.name %></td>
FATAL -- : [e8968d66-5740-4005-9236-fd3e4cc61542] app/views/locations/index.html.erb:21:in `_app_views_locations_index_html_erb___341067609742207438_69941629868780'
This is the method that does the search:
def index
if params[:search].present?
@search = params[:search]
@locations = Location.where('id LIKE ? OR user_id LIKE ?', "%#{@search}%", "%#{@search}%")
else
@locations = Location.all
end
end