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

  • Home
  • SEARCH
  • 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 8889939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:23:10+00:00 2026-06-14T22:23:10+00:00

I’ve got a one-off script that I’m using to load some data into my

  • 0

I’ve got a one-off script that I’m using to load some data into my application’s database.

This is kind of large-ish so I’ve gist’d it here: https://gist.github.com/097fb5a30ce84522077a

The code as written works flawlessly when executing against a local Postgres instance on my local machine (or even a remote instance) as specified by the DATABASE_URL environment variable.

However, it will absolutely not work from Heroku. Executing the ruby script linked gives me this error:

~ $ ruby importprofiles.rb
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/attribute_assignment.rb:88:in `block in assign_attributes': unknown attribute: owner_id
(ActiveRecord::UnknownAttributeError)

My workflow is basically:

  • Create the app on Heroku (heroku create mybot)
  • Push the code up (git commit -m 'initial commit' && git push heroku master)
  • Set up the database (heroku run rake db:setup)
  • Restart the instance (heroku restart)
  • Invoke a Bash shell on the heroku instance (heroku run bash)
  • Use Curl to pull down my production profiles.ini from a server (curl http://blah.com/profiles.ini > profiles.ini)
  • Run the script (ruby importprofiles.rb)

Why am I getting unknown attribute errors on Heroku for code that works locally?

  • 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-14T22:23:11+00:00Added an answer on June 14, 2026 at 10:23 pm

    Your schema.rb doesn’t match your real database or you’ve never tried to use a Profile owner for anything. You have this in schema.rb:

    create_table "profiles", :force => true do |t|
      t.string   "title",   :limit => 100
      t.integer  "owner"
      t.datetime "timeset"
      t.string   "whoset"
    end
    

    The t.integer "owner" defines a column named owner in the profiles table but you need an owner_id column.

    Perhaps you did a manual alter table to rename the column in your development environment. Or maybe this is the first time you’ve gone along this code path.

    In any case, you need a migration to rename profiles.owner to profiles.owner_id. Or, since you’re just getting started, you could hand-edit schema.rb to rename the column and the rebuild your Heroku database. I’d just patch schema.rb by hand and start again if you don’t have any data to worry about.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’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
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the
I've got a string that has curly quotes in it. I'd like to replace
I have a small JavaScript validation script that validates inputs based on Regex. I
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into

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.