[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

output to mysql db

furfey@gmail.com

1/17/2007 6:11:00 PM

Hello,

Very new to Ruby and I'm curious if this is possible....

I have the following code which is returning a chunk of html that I
want.

Right now, all it does is print to the screen. Is it possible to have
the outputted chunk of html placed in a mysql db record? If so, can
anyone recommend some starting resources or examples.

Thanks!


#!/usr/bin/env ruby

require 'hpricot'
require 'open-uri'

doc = Hpricot(open("some_url"))

doc.search('dir').each do | element |
puts "#{element.inner_html}"
end

1 Answer

Chris Lowis

1/17/2007 6:36:00 PM

0

furfey@gmail.com wrote:
> Hello,
>
> Very new to Ruby and I'm curious if this is possible....
>
> I have the following code which is returning a chunk of html that I
> want.
>
> Right now, all it does is print to the screen. Is it possible to have
> the outputted chunk of html placed in a mysql db record? If so, can
> anyone recommend some starting resources or examples.

Try ActiveRecord it's part of Ruby on Rails :
http://rubyonrails.org/api/classes/ActiveRecord...

There's some good examples in the Ruby Cookbook:
http://www.crummy.com/writing/Rub...

Chris


--
Posted via http://www.ruby-....