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 7898159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:21:30+00:00 2026-06-03T08:21:30+00:00

I’m getting the following error after I deploy to heroku (running PG), though it

  • 0

I’m getting the following error after I deploy to heroku (running PG), though it works fine in local (running sqlite3)

ActionView::Template::Error (PGError: ERROR:  column "calendar_day" does not exist
LINE 1: ...ated_at > '2012-04-09 19:39:54.787077') AND (date(calendar_d...
                                                         ^
SELECT  date(created_at) as calendar_day, count(*) as total_checkins FROM "checkins"  WHERE (user_id = 1 AND group_id = 1 AND created_at > '2012-04-09 19:39:54.787077') AND (date(calendar_day) = '2012-05-07') GROUP BY date(created_at) LIMIT 1):
...
app/helpers/groups_helper.rb:32:in `checkin_day'

Note that “calendar_day” is not an actual column on a persisted table, but one I define on the fly using an AS statement (not sure what this is technically called). The relevant helper functions are shown below. Basically, at the top of the page I make a call to calendar_view, later I pass the results to checkin_day as the checkins parameter. It’s on this checkin_day call that I hit the error. Any idea why this works fine in local but not in heroku?

def calendar_view(member, timeperiod)
  Checkin.select("date(created_at) as calendar_day, count(*) as total_checkins").where("user_id = ? AND group_id = ? AND created_at > ?", member.member.id, member.group.id, Time.now - timeperiod.days).group("date(created_at)")
end

def checkin_day(checkins, day)
  ch = checkins.where("date(calendar_day) = ?", day).first
  return ch.total_checkins if ch
  return 0
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-06-03T08:21:31+00:00Added an answer on June 3, 2026 at 8:21 am

    Stuff you define on the SELECT part of the query (projection) is not available during the evaluation of the WHERE clause (selection). You have to define it again there:

    def checkin_day(checkins, day)
      ch = checkins.where("date(created_at) = ?", day).first
      return ch.total_checkins if ch
      return 0
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.