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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:52:50+00:00 2026-05-29T11:52:50+00:00

I have just changed a column (called time) from t.string to t.datetime and then

  • 0

I have just changed a column (called time) from t.string to t.datetime and then dropped and re-created the database and run the migration.

I have a script set to run every minute that scrapes information from a remote website and then adds the information to new records based on the time column that I adjusted to be a datetime rather than string.

# Add each row to a new call record
page = agent.page.search("table tbody tr").each do |row|
next if (!row.at('td'))
time, source, destination, duration = row.search('td').map{ |td| td.text.strip }
call = Call.find_or_create_by_time(time)
call.update_attributes({:time => time, :source => source, :destination => destination, :duration => duration})
end

Since changing the time column to integer the script doesn’t seem to be importing any information at all. I wondered if there is an extra step that I need to do to make this work again?

My schema looks like this:

create_table "calls", :force => true do |t|
    t.string   "source"
    t.string   "duration"
    t.datetime "time"
    t.string   "destination"
    t.string   "recording"
    t.string   "cost"
    t.datetime "created_at"
    t.datetime "updated_at"
  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-05-29T11:52:51+00:00Added an answer on May 29, 2026 at 11:52 am

    In this part

    time, source, destination, duration = row.search('td').map{ |td| td.text.strip }
    call = Call.find_or_create_by_time(time)
    

    you get time variable as a string, and trying to find_by it. I think smth like

    call = Call.find_or_create_by_time(Time.parse(time))
    

    should do the trick

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

Sidebar

Related Questions

We have just 'migrated' an SQL Server 2005 database from DEVEL into TEST. Somehow
I have a table in Rails with just one column called :name . When
Hi I am using Mysql 5.0.x I have just changed a lot of the
I have just installed a new ssl certificate on GlassFish 3. I also changed
I have just installed C# for the first time, and at first glance it
I have a table that contains a column called 'id' that is an INT
I want to select rows from a table called Users where the column Logon
I have a database with a table called shuffledQuestions with 2 columns category_id and
I have a table in my DB called CompanyDetails . It has a column
I have a column of data in SQL that is currently in the datetime

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.