Prev | Current Page 301 | Next

David Berube

"Practical Reporting with Ruby and Rails"


ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:host => "your_mysql_hostname_here",
:username => "your_mysql_username_here",
:password => "your_mysql_password_here",
:database => "company_pr")
end
class Stories < ActiveRecord::Base
end
unless Stories.table_exists? # If this is the first time running this app,
# create the tables we need.
ActiveRecord::Schema.define do
create_table :stories do |t|
t.column :guid, :string
t.column :title, :string
t.column :source, :string
t.column :url, :string
t.column :published_at, :datetime
t.column :created_at, :datetime
end
create_table :cached_feeds do |t|
t.column :url , :string
t.column :title, :string
t.column :href, :string
t.column :link, :string
t.column :feed_data, :text
CHAPTER 11 n TRACKING THE NEWS WITH GOOGLE NEWS 218
t.column :feed_data_type, :string, :length=>25
t.column :http_headers, :text
t.column :last_retrieved, :datetime
end
# Without the following line,
# you can't retrieve large results -
# like those we use in this script.


Pages:
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313