Your @original object seems to be an Array instead of an Active Record object. So all you have to do is to loop through the @original and for each value save the data.
On Wed, Dec 21, 2011 at 11:07 AM, MUMU <[email protected]> wrote: > Hi all, > I have created a ruby script which scraps the video url from a > website I want to implement it in rails I tried to implement it but I > am unable to implement it it shows [[undefined method `save' for > []:Array]]....... > > > Here is my controller code > > class DevourController < ApplicationController > require 'net/http' > require 'open-uri' > def index > source =[] > array = Array.new > for path in 1..2 > puts "Currently Executing Page No:----#{path}" > source = Net::HTTP.get('devour.com',"/#{path}") > html_tags=source.scan(/https?:[^"]*|http?:[^']*/) > #html_tags.gsub(/['"]/) > #puts html_tags > videos=[] > html_tags.each do |links| > videos << links if links.include?("/video/") > end > videos.uniq! > #puts videos.size > l=[] > videos.each do |y| > l << y.chomp('/') > array << l > end > puts l > puts "Successfully Executed" > end > array.uniq! > #puts l > puts array > puts array.size > puts "**********************************" > #Executing The Links To Get The Video Links > @original =[] > array.each do |f| > f.each do |url| > puts url.class > puts url > uri=URI(url) > @original << Net::HTTP.get(uri) > end > end > puts @original > puts @original.size > end > > def create > @original=Link.all > @original.save > end > > end > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- Please consider the environment before printing this email. Regards, Surya -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

