Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5994405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:48:47+00:00 2026-05-22T23:48:47+00:00

I’m getting a postgreSQL error on heroku that I don’t get locally on my

  • 0

I’m getting a postgreSQL error on heroku that I don’t get locally on my computer which also uses postgreSQL.

I have a search form with checkboxes and a model with boolean fields. When I check the box to find all reports that are completed, the form passes the parameter value completed=’on’. As shown by the heroku logs, the database doesn’t like using that parameter value with a boolean in its sql. I would have thought rails would somehow change it from ‘on’ to true, regardless, the search form works fine locally.

How can I get this to work on Heroku?

Once the website is live on Heroku how do I test future changes if there are issues like this where it works locally but not on the server? Does Heroku give you an area for testing a different version of your app?

Details:

Local Development Log

[1m[35mReport Load (0.8ms)[0m  SELECT "reports".* FROM "reports" WHERE ("reports"."user_id" = 1) AND (completed = 'on') LIMIT 4 OFFSET 0

Heroku Log

ActiveRecord::StatementInvalid (PGError: ERROR:  invalid input syntax for type boolean: "on"
2011-06-08T00:17:21+00:00 app[web.1]: : SELECT  "reports".* FROM "reports" WHERE  ("reports"."user_id" = 2) AND (completed = 'on') LIMIT 4 OFFSET 0):
2011-06-08T00:17:21+00:00 app[web.1]:   app/controllers/reports_controller.rb:6:in `index'

Controller

def index
  @reports = Report.accessible_by(current_ability).search(params)
  @reports = @reports.paginate :per_page => 4, :page => params[:page]
  respond_to do |format|
    format.html
    format.xml  { render :xml => @reports }
  end
end

View

<%= form_tag(reports_path, :method => "get") do %>
<ul>    
    <li>
        <%= link_to 'Show All', reports_path %>
    </li>       
    <li>
    <%= label_tag(:report_number, "Report Number") %>
    <%= text_field_tag(:report_number,nil, :value => params[:report_number]) %>
    </li>
    <li>
    <%= label_tag(:job_number, "Job Number") %>
    <%= text_field_tag(:job_number,nil, :value => params[:job_number]) %>
    </li>
    <li>
    <%= label_tag(:has_failures, "Failures") %>
    <%= check_box_tag(:has_failures,nil, params[:has_failures]) %>
    </li>
    <li>
    <%= label_tag(:completed, "Completed") %>
    <%= check_box_tag(:completed, nil, params[:completed]) %>
    </li>

    <li>
        <%= submit_tag("Search") %>
    </li>                   
</ul>

<% end %>

Model

def self.search(criteria)
 if !criteria[:report_number].blank?
    where("report_number = ?",criteria[:report_number])
  elsif !criteria[:job_number].blank?
    joins(:site).
    where("sites.job_number = ?",criteria[:job_number])
  else
    composed_scope = scoped
    if !criteria[:has_failures].blank?
     composed_scope = composed_scope.where("has_failures = ?",criteria[:has_failures])
   end
   if !criteria[:completed].blank?
      composed_scope = composed_scope.where("completed = ?",criteria[:completed])
   end
   composed_scope
  end
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:48:48+00:00Added an answer on May 22, 2026 at 11:48 pm

    This is probably due to a Postgres version mismatch. ‘on’ became a valid value for boolean fields in Postgres 8.4, so I guess Heroku is still on 8.3. You’ll just need to make sure you pass true or false into your query instead.

    As far as testing goes, you can indeed setup a staging environment. You can either setup two git remotes for production/staging per this article: http://devcenter.heroku.com/articles/multiple-environments.

    Or you can setup a separate staging application and use heroku_san to work with your two applications.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.