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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:21:36+00:00 2026-05-26T11:21:36+00:00

In my app, I’m able to save the user_id on my development machine using

  • 0

In my app, I’m able to save the user_id on my development machine using sqlite. However, the user_id is not being saved on my Heroku site, which uses Postgresql:

class ReviewsController < ApplicationController

  before_filter :authenticate_user!, :find_product

  def new
    @review = Review.new    
  end

  def create
    @review = @product.reviews.build(params[:review]) 
    @review.user_id = current_user.id 
    if @review.save
      SiteUpdatesMailer.review_added(@review).deliver 
      redirect_to product_path(@product), :notice => 'Thanks for your review!'     
    else
      render :action => :new    
    end
  end

  private

  def find_product
    @product  = Product.find(params[:product_id])    
  end

end

The user must be signed in to add a review. Should I be saving the user_id a different way?

  • 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-26T11:21:37+00:00Added an answer on May 26, 2026 at 11:21 am

    Here’s a wild guess: you have a string column in Review that has a limit and you’re exceeding that limit when you say @product.reviews.build(params[:review]). SQLite doesn’t pay attention to size limits on varchar columns, PostgreSQL does and complains if you try to insert a value that is larger than the column size.

    And some advice for free: don’t develop on SQLite if you’re going to deploy to Heroku (or anywhere else that doesn’t use SQLite), all databases are different and no ORM will protect you from those differences.

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

Sidebar

Related Questions

Our app (already deployed) is using an Access/Jet database. The upcoming version of our
My app (winforms .net 2.0 / vs2008) works fine on my dev machine but
My app is crashing using iOS5 and iOS4.3 iPhone simulators in Xcode 4.2, the
App runs on simulator on my MacBook Air, but not on iMac. I have
The app engine datastore, of course, has downtime . However, I'd like to have
app.get('/',function(req,res){ res.render('home'); // I want the template to be able to access the flash
We're building an app, our first using Rails 3, and we're having to build
My app must NOT auto -rotate at all. But it includes a screen which
My app needs to be able to disconnect from a server and connect to
Web app is being written in classic ASP with a MSSQL backend. On this

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.