All Questions
24 questions
0
votes
1
answer
1k
views
Ruby create Tempfile to save CSV row and assign it to database
I have very complex problem here.
I'm exporting two spreadsheets using CSV library and there are one to many association between the two sheets
The problem is i need to save the foreign key for ...
0
votes
0
answers
645
views
Ruby (no Rails) How to write numeric values using a decimal comma to csv file
I'm trying to read data from a MySql query I wrote and write it to a csv file.
All of this using ruby itself, no Ruby on Rails or any WebFramework involved.
Unfortunately, the numbers are required to ...
1
vote
1
answer
83
views
Joining two .csv files in Ruby by id when their respective row numbers do not match
Say I have a .csv file like this, call it A.csv
1234 a d g j m p s
5678 b e h k n q t
9012 c f i l o r u
and another, call it B.csv, like
1234 g a q ...
0
votes
1
answer
273
views
Splitting the Rows of a MySQL Query Using Ruby and Writing to a CSV File
Using Ruby to automate MySQL queries from a remote database, I wish to split rows based on the value of the month query found below.
This is to generate a week-by-week (Wednesday to the following ...
0
votes
1
answer
80
views
Creating CSV Using Multiple Ruby Queries Across All Columns
I am using Ruby to automate reporting from a remote MySQL database. I am using multiple queries (and not joining them into one) as I eventually wish to split rows based off a given value in one or ...
-1
votes
2
answers
295
views
Adding Columns (SQL Queries) to a CSV File in Ruby
I have been unable to figure out how to write additional columns, not rows, to a CSV file in Ruby. In this case, they are SQL queries.
Snippet of my code:
month = mysql.query("SELECT DATE_FORMAT(...
0
votes
2
answers
85
views
Using Ruby to create CSV file from MySQL DB not creating file
When I try to create a CSV file from a MySQL DB using ruby no file is created and no error is returned. This is on a Windows 10 machine.
Here is my code:
def dump_csv
Dir.mkdir 'C:\temp' unless ...
0
votes
0
answers
221
views
No such file or directory - questions.csv
Hi friends i am getting above error when i tried to import .csv file from the user. I tried with different methods but it is not working. Please help me resolve this issue. I am new to Ruby family. ...
3
votes
1
answer
487
views
Import data from user .csv file into table
In a Ruby on Rails web app, I want to import a .csv file from a user and the data present in the .csv file will be inserted into the questions table, but I'm getting errors when I run the application.
...
9
votes
2
answers
7k
views
Ruby on Rails 4 - CSV import - no implicit conversion into string
I'm trying to import CSV data to my mysql DB but I'm running into an error when I try to upload the file :
no implicit conversion of ActionDispatch::Http::UploadedFile into String
This is what a line ...
-1
votes
1
answer
31
views
How to retrieve column value from table1 and keep it in table2's column?
Table_1:
ID | Name | Address
1 | prakash | 2-107, NY
2 | rakesh | 2-109/a, NY
Table_2:
emp_ID| Name | Designation
? | Prakash | Software Developer
? | Rakesh | Software ...
0
votes
2
answers
794
views
undefined local variable or method `category' for main:Object (NameError)
require 'csv'
load 'dbconnection.rb'
require 'activerecord'
class Definition<ActiveRecord::Base
end
csv_definition = File.read('C:/definition.csv')
spy_definition = CSV....
1
vote
1
answer
153
views
Loading CSV file Data into Mysql using Rubygems
Trying to insert the data into DB from a csv file using ruby programming.
I am fresher to scripting in ruby because of this facing issue.
the data in CSV file is as follows:
12,prakash,nair,kerala,...
0
votes
1
answer
362
views
How insert csv into mysql with rails in join table?
I have 3 models Items Gosts and Item_Gosts
item.rb
class Item < ActiveRecord::Base
has_many :item_gosts
has_many :gosts, through: :item_gosts
end
item_gost.rb
class ItemGost < ...
0
votes
1
answer
150
views
How to add an array of records to row from active-record model in a CSV export file in rails
I am trying to add records to a row from an active-record model.
The CSV row is:
csv << [ "Question_name", "Question_description" ]
I am having an answer model which contain name attribute. I ...