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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:56:06+00:00 2026-06-16T00:56:06+00:00

I planned everything carefully and tested locally, but after deploying may have created many

  • 0

I planned everything carefully and tested locally, but after deploying may have created many useless records that have crashed the app on heroku.

My aim is to consolidate many models into one Topic model, so I used the below script in Heroku console (though should have tested one record at first):

> Question.find_each do |q|
* @qt=q.title
> @qd=q.description
> @q="Question"
> @ca=q.created_at
> @ui=q.user.id
> @uvt=q.user_votes_total
> Topic.create!({:title => @qt, :description => [@qd], :kind => @q, :created_at=>@ca, :user_id=>@ui, :user_votes_total=>@uvt })
> end  

Heroku returns this:

Question Load (1.8ms)  SELECT "questions".* FROM "questions" WHERE ("questions"."id" >= 0) ORDER BY "questions"."id" ASC LIMIT 1000
User Load (6.5ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 3331 ORDER BY users.created_at DESC LIMIT 1  

And, this DOH!:

WARNING: Can't mass-assign protected attributes: title, description, kind, created_at, user_id, user_votes_total

My topic model looks like this:

class Topic < ActiveRecord::Base
  attr_accessible :description, :title, :kind, :user_id, :tag_list,
              :subject, :image_attributes, :tags_attributes, :created_at,
              :user_votes_total
  validates :title, :presence => true,
                :length => { :minimum => 5 }
  validates :description, :presence => true
  validates :kind, :presence => true
  belongs_to :user
  has_many :adds
  default_scope order: 'topics.created_at DESC'

  votable_by :users
  acts_as_taggable

  has_one :image, :as => :parent, :dependent => :destroy
    accepts_nested_attributes_for :image, :allow_destroy => true
    after_create do
     self.create_image unless image
    end
  has_many :comments, :as => :commentable, :dependent => :destroy

  include PgSearch
  pg_search_scope :search, against: [:title, :description, :kind],
     using: {tsearch: {dictionary: "english"}}
end

I have searched for relevant information, but can’t figure out why Heroku is not playing along. Has anyone encountered this issue?

  • 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-16T00:56:07+00:00Added an answer on June 16, 2026 at 12:56 am

    I was able to overcome the issue by running:

    `heroku restart`
    

    https://devcenter.heroku.com/articles/ps

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

Sidebar

Related Questions

we have a number of functional deliverable planned for 2010 but we also have
We are planned to use MySQL 5.5 but we do saw that there are
In short, when you have planned or have thought about an idea to create
I have a fairly large C++ application (on Windows, no other platforms planned), which
We have a Spring + Ibatis based J2EE app. I planned to wrap around
My place of work currently uses CVS. A git migration is planned but it
Im really really new to Javascript but Ive got this script that loads the
I have a project that was so poorly designed that it's a basically a
I have a Java program that makes a request to a web service that
There is quite a few questions here about Transactions and JUnit. But please have

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.