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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:54:30+00:00 2026-05-28T03:54:30+00:00

Having a little trouble fixing an error. All works great on local machine. On

  • 0

Having a little trouble fixing an error.

All works great on local machine.
On PG, heroku is the error.

Here are the logs :

  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m ActionView::Template::Error (PGEr
  ror: ERROR:  operator does not exist: character varying = integer
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m LINE 1: ...T "reviews".* FROM "re
  views"  WHERE "reviews"."trip_id" = 32
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m : SELECT "reviews".* FROM "review
  s"  WHERE "reviews"."trip_id" = 32):
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m     31:   <div style='display:non
  e'>
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m     33:      <% for review in @tr
  ip.reviews %>
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m     34:
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m     32:    <div id="inline">
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m HINT:  No operator matches the gi
  ven name and argument type(s). You might need to add explicit type casts.
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m   app/controllers/trips_controlle
  r.rb:21:in `show'
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m cache: [GET /trips/32] miss
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m     36:     <li> <%= review.conte
  nt %> </li>
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m     35:     <ul>
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m   app/views/trips/show.html.erb:3
  3:in `_app_views_trips_show_html_erb__3301405670044045300_69859019468960'
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m Completed 500 Internal Server Err
  or in 86ms
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m   Parameters: {"id"=>"32"}
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m   Processing by TripsController#s
  how as HTML
  ←[32m2012-01-09T19:52:24+00:00 app[web.1]:←[0m Rendered trips/show.html.erb with
  in layouts/application (81.8ms)

Not really sure where exactly, the error occurs and how to fix it.

reviews.rb

 class Review < ActiveRecord::Base
  belongs_to :trip
 end

 class Trip < ActiveRecord::Base
  has_many :reviews, :dependent => :destroy
  attr_accessible, :reviews_attributes

  accepts_nested_attributes_for :reviews, :reject_if => lambda { |a| a[:name].blank? }, :allow_destroy => true
 end 

show.html.rb

 <%= link_to "Read Reviews", '#inline',  :id => 'various1', :class => 'review' %>  

 <div style='display:none'>  
   <div id="inline">
      <% for review in @trip.reviews %>  
       <ul>
         <li> <%= review.content %> </li>
         <li> <i> <%= review.name %> </i> </li>
       </ul>
     <% end %>  
  </div> 
 </div>

The thing that confuses me is that I have two other practically the same models, but they work well.

Thanks!

  • 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-28T03:54:30+00:00Added an answer on May 28, 2026 at 3:54 am

    Your problem is here:

    WHERE "reviews"."trip_id" = 32
    

    and the error message says that:

    operator does not exist: character varying = integer

    so you have created your trip_id column in reviews as a string rather than as an integer. That will work fine in SQLite because SQLite’s type system is rather loose but it won’t work in PostgreSQL as PostgreSQL is quite a bit stricter.

    You could try adding a migration to fix the type of trip_id:

    def change
      change_column :reviews, :trip_id, :integer
    end
    

    and if that doesn’t work then drop and recreate the table:

    def change
      drop_table :reviews
      create_table :reviews do |t|
        #...
        t.integer :trip_id
        #...
      end
    end
    

    You could also do an ALTER TABLE through raw SQL if you have data that you want to preserve and the change_column doesn’t work:

    def change
      execute %q{
        alter table reviews
        alter column trip_id
        type int using cast(trip_id as int)
      }
    end
    

    That should work in PostgreSQL (but not SQLite) as long as you don’t have any broken data in your trip_id.

    Once you have that sorted out, you should install PostgreSQL and switch your development environment to that. Developing on top of SQLite and deploying to PostgreSQL (or developing on top of one database and deploying on top of any other database for that matter) is a bad idea and will cause you all sorts of grief and confusion.

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

Sidebar

Related Questions

I'm having a little trouble defining my question. Here's what I have. A mailto
am having a little trouble here. i am trying to store and retrieve images
I'm having a little trouble reading the values of all the sub child nodes
I'm having a little trouble making an SQL SERVER 2000 query. Here is my
I'm having a little trouble organizing my error messages for two interacting classes. One
I'm having a little trouble getting erlang to give me a unicode string. Here's
hi im having little trouble at inserting date from drupal to mysql here the
I'm having a little trouble with this. First of all, this is for a
I'm having little trouble creating a script working with URLs. I'm using urllib.urlopen() to
I m having little trouble finding a relation between the movement at centre and

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.