here's a quick test I made on my model:
1.
pry(main)> output = JobUser.first(10).to_s
=> "[#<JobUser id: 10001, instagram_user_id: 297705889, job_id: 2, invited: true, created_at: \"2013-09-23 21:53:37\", updated_at: \"2013-09-23 21:53:37\">, #<JobUser id: 10002, instagram_user_id: 36823356, job_id: 2, invited: true, created_at: \"2013-09-23 21:53:37\", updated_at: \"2013-09-23 21:53:37\">, #<JobUser id: 10003, instagram_user_id: 509682835, job_id: 2, invited: true, created_at: \"2013-09-23 21:53:37\", updated_at: \"2013-09-23 21:53:37\"> ....
2.
parsed = output.gsub('#<', '').gsub('>', '').gsub(/^\[/, '').gsub(/\]$/, '').split('JobUser').map(&:strip)
=>
"id: 10001, instagram_user_id: 297705889, job_id: 2, invited: true, created_at: \"2013-09-23 21:53:37\", updated_at: \"2013-09-23 21:53:37\",",
"id: 10002, instagram_user_id: 36823356, job_id: 2, invited: true, created_at: \"2013-09-23 21:53:37\", updated_at: \"2013-09-23 21:53:37\",",
"id: 10003, instagram_user_id: 509682835, job_id: 2, invited: true, created_at: \"2013-09-23 21:53:37\", updated_at: \"2013-09-23 21:53:37\"...
3.
parsed.shift
because the first element in array will be a blank string
4.
records = parsed.map { |serialized_record| JobUser.new(eval "{ #{serialized_record} }") }
then you should probably run something like records.each { |record| record.save }
Please note that you should replace JobUser
with your model name.
The point is you'll have to parse the string and insert it back into database
good luck!