Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
75 views

How to use activerecord-import to upsert only when values have changed? Body: I'm using the activerecord-import gem in a Rails 6 app to bulk upsert data into a PostgreSQL database. Here's an example ...
Raghvendra Rao's user avatar
0 votes
0 answers
24 views

I have a Rails model with an after_commit callback that sends a notification to users. However, this operation takes too long, so I want to move it to a background job. Current Code: I create or ...
Amol Mohite's user avatar
1 vote
1 answer
290 views

I am trying to do an upsert with ActiveImport. When running the import I am trying to pass it a named constraint in order to tell it when to update certain columns. User.import( @import_values, ...
Ilovebathroomlights's user avatar
0 votes
1 answer
573 views

I have a unique constraint on two columns, one being the primary key and also have a unique index on another column. When I use import method, I can only define one conflict_target as far as I know. ...
webgoesviral's user avatar
0 votes
0 answers
152 views

@report = current_account.reports.new(report_params) @report.name.try(:strip!) @report.report_type = "campaign" @report.save Reports has_and_belongs_to_many contacts and vice versa When we have ...
Radz Singh's user avatar
0 votes
1 answer
2k views

Attempting to update a large dataset with ActiveRecord Import, I'm struggling to see why my insert is failing. In my schema for the model, this line exists: t.index ["variant_id", "...
Jake Penn's user avatar
1 vote
1 answer
454 views

I am creating a few records programmatically based on a users input and creating an array of records to import. When I check the database I can see the relationship has been created if they are new ...
Max Rose-Collins's user avatar
2 votes
2 answers
2k views

Trying to import CSV file to the database using "activerecord-import gem". I have the following Models question.rb require 'csv' class Question < ApplicationRecord has_many :question_answers, ...
FDI's user avatar
  • 811
0 votes
1 answer
2k views

How is possible to SUM the value of array to my existing row field during on_duplicate_key_update? For example: Model.import array, on_duplicate_key_update: [ :column_value + array_value] Thank you.
Mr McDonald's user avatar
0 votes
0 answers
2k views

I'm using activerecord-import to bulk update a single field on existing records. While I am learning how to use the gem. Is there a way to restrict so nothing ever gets created? I'm currently using ...
Jay Killeen's user avatar
  • 2,932
1 vote
2 answers
472 views

Need to import csv data inside a zip file to my product model using activerecord-import and rubyzip gem. This code works (download the zip and display the csv name) desc "Import products data from ...
arnaudjnn's user avatar
  • 1,063
0 votes
1 answer
567 views

I need to insert a lot of data into a new database. Like, a lot of data, so even nanoseconds count in the context of this query. I'm using activerecord-import to bulk-insert into Postgres, but that ...
ActiveModel_Dirty's user avatar
3 votes
1 answer
3k views

I am using active-record import gem in a class method to import array of listings read from csv file as shown in code below: def self.import_listings(file) start = Time.now ...
Saurav Prakash's user avatar
3 votes
1 answer
1k views

I have an issue with importing a lot of records from a user provided excel file into a database. The logic for this is working fine, and I’m using ActiveRecord-import to cut down on the number of ...
Nick Barreto's user avatar
6 votes
1 answer
2k views

I'm using activerecord-import gem to import multiple ActiveRecord documents in single query. Then I'm initializing related associations using saved documents ids and importing them too, and so on. ...
BoP's user avatar
  • 477
1 vote
0 answers
519 views

With help of activerecord-import gem I'm trying to save list of records with has_many through children in one query. my models: class Mailing < ActiveRecord::Base has_many :...
Pavel's user avatar
  • 1,984
4 votes
3 answers
5k views

I'm trying to read a 5MM line file and right now it is exceeding my alotted memory usage on heroku. My method is somewhat fast ~200 inserts/second.. I believe it's crashing on the import.. So my plan ...
gemart's user avatar
  • 376
0 votes
1 answer
684 views

I’m using PostGres 9.5. I have the following set up in my table, in hopes of auto-generating IDs … myproject=> \d my_object_times Table "public.my_object_times" ...
user avatar
1 vote
1 answer
80 views

How can activerecord objects be edited externally with scripts? I'm currently using the activerecord-import gem to insert objects into the database. Is it possible to edit existing records using this ...
Kevin's user avatar
  • 35
0 votes
0 answers
745 views

Ruby 2.3.0, Rails 4.2.4, PostgreSQL 9.5 UPDATE: added activerecord-import code below. Does anyone know how to make these associations hold, so that a model's table attributes can be referenced in ...
JHFirestarter's user avatar
-4 votes
1 answer
2k views

I have an array of new objects of active records I want to save them all in one query and I also want to call before_create callback. I used activerecored-import gem and also tried with insert method ...
Asnad Atta's user avatar
  • 4,013
8 votes
1 answer
5k views

I am trying to use activerecord-import, but I can't seem to get my application to recognize its existence. I get undefined method `supports_import?' for #<Class:...> or undefined method `...
user1070300's user avatar
0 votes
1 answer
206 views

I am using activerecord-import to bulk insert a bunch of data in a .csv file into my rails app. Unfortunately, I am getting an error when I call import on my model. ArgumentError (invalid byte ...
Evan V's user avatar
  • 1,887
7 votes
3 answers
5k views

I'm trying to use the activerecord-import gem and I've followed the directions on the wiki to a tee but I'm getting a NoMethodError: undefined method 'import' for #<Class:0x8b009b0>. Here's my ...
yiinewbie's user avatar
  • 1,055