Scaffolding question

The "integer", "string" and "float" methods are just shorthands for the column call using that type.

It's also the "new way" (new since Rails 2, not that new now) of writing migrations. And the "timestamps" will create both a created_at and also an updated_at column.

Maurício Linhares wrote:

The "integer", "string" and "float" methods are just shorthands for the column call using that type.

It's also the "new way" (new since Rails 2, not that new now) of writing migrations. And the "timestamps" will create both a created_at and also an updated_at column.

- Maur�cio Linhares http://alinhavado.wordpress.com/ (pt-br) | http://codeshooter.wordpress.com/ (en)

Thanks Mauricio - I actually like it better than having to do things a long way. Anything shorter is better, IMO. I appreciate the explanation.

I have one more question..

I've created a ruby program that actually parses raw statistics from the main NCAA web site, which I want to bring into my own database.

So, using the example above.. here's an example of the parser I created:

#== Scraper Version 1.0

If crawling through the NCAA website is something that you want to automate, as "crawl daily at 12 pm" you can create a rake task in your Rails application that calls this code and then put the rake task to be run as a cron job:

#ncaa_crawler.rake at /lib/tasks

rake :ncaa_crawler => :environment do   #here goes the code that gets the NCAA data   #and saves it into the database end

The :environment thing tells Rake that it should load the rails application before executing the task, so all objects defined in your Rails application will be available, like your ActiveRecord models.

This code you have shown should be placed into a class in your application and be called on this rake task.

Thanks again Mauricio, I will look into trying this out. Is the rake task able to be defined periodically by a weekday? For instance, if I want the job to only pull data on a Monday (is that feasible)?

That's not really related to the rake task, it's a cron config (i'm guessing that you're on Linux or some kind of OS that has the cron utility).

You can google about cron and config it the way you want. Then cron will call your rake task as needed.

Thanks for the information. I have a dual-developing platform (windows and linux) but my host is on linux..