I'm deploying my Ruby app in Heroku, I've changed my Gemfile to use sqlite in development and PG in production
Gemfile
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger
console
gem 'byebug'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
group :production do
gem 'pg', '~> 0.11'
gem 'rails_12factor'
end
I have a problem in my heroku logs :
**ActionView::Template::Error (PG::GroupingError: ERROR: column "polls.id" must appear in the GROUP BY clause or be used in an aggregate function**
I don't know how to modify my query and my code to make it works with PG.
My view index.html.erb
<%= @polls.where(question_id: Question.where(formulaire_id: @formulaire)[i]).length %> réponses
<% @polls.select(:created_at).where(question_id: Question.where(formulaire_id: @formulaire.id)[i]).as_json(only: [:created_at]).uniq{|x| x.to_s} %>
<% @NbRepondant = @polls.select(:created_at).where(question_id: Question.where(formulaire_id: @formulaire.id)[i]).as_json(only: [:created_at]).uniq{|x| x.to_s}.length %>
Thank you for your help !