Just to throw another spanner in the works for you, I wonder if this
wouldn't be achieved more easily using scRUBYt!. The latest skimr
branch (http://github.com/scrubber/scrubyt/tree/skimr) lets you quite
easily store the results of a scrape directly into an ActiveRecord
model.
Drop me a line if
Okay,
The end result was modifying the model for the table I was working with
to do the following:
class RushingOffense < ActiveRecord::Base
def scrape
offensive_rushing =
Scraper.new('http://web1.ncaa.org/mfb/natlRank.jsp?year=2008&rpt=IA_teamrush&site=org',
'table', 'statst
Frederick Cheung wrote:
> On Jun 8, 5:11�am, "J. D." wrote:
>> have to figure out how to check whether or not it returns nil and create
>> data..
>
> It will never return nil. It will return an array (possibly an empty
> one). You might want to set your own timestamp and use that rather
> than r
On Jun 8, 5:11 am, "J. D." wrote:
> Hi Fred,
>
> I think I will use this for my find parameter:
>
> start_date = Time.now.beginning_of_week
> end_date = Time.now.end_of_week
> @rushing_offenses = RushingOffense.find(:all, :conditions =>
> ['created_at > ? and created_at < ?', start_date
Hi Fred,
I think I will use this for my find parameter:
start_date = Time.now.beginning_of_week
end_date = Time.now.end_of_week
@rushing_offenses = RushingOffense.find(:all, :conditions =>
['created_at > ? and created_at < ?', start_date, end_date])
That will let me find anything creat
By the way Fred,
I really do appreciate you taking the time to help me and isolate some
of my issues. I want to be proactive with my own code and later on with
helping others. My goal is to gain an understanding of best practice
methods and start utilizing those methods in my code from the s
Frederick Cheung wrote:
>
> Sounds like you shouldn't be using update_all at all here, rather you
> should be using find to find an appropriate row to update and if there
> is none, create a new one.
>
> Fred
Again, the problem is I don't know how. I'm simply guessing based on
what I see with
On Jun 8, 12:22 am, "J. D." wrote:
> Hi Fred,
> puts "Updating Team Name = #{offensive_rushing.rows[i][1]}."
> --> Print me out an update to show me that you are updating the teams
> RushingOffense.update_all(:name => offensive_rushing.rows[i][1],
> :games => offensive_rushing.rows[i][
Hi Fred,
Yeah I'm stuck with this one. I've checked the documentation but I'm
just not following it.
What I basically need it to do is to update the table with the data
that's parsed into @rows.
In this case @rows is listed by:
offensive_rushing.rows[i][1] (:name)
offensive_rushing.rows[i][
On Jun 8, 12:02 am, Frederick Cheung
wrote:
> On Jun 7, 10:01 pm, "J. D." wrote:
>
>
>
> > Any ideas of what I might be doing wrong?
>
> You're not using update_all correctly - check the documentation
>
Well the documentation may not mention the usage you are using, but it
does exist, sorry ab
On Jun 7, 10:01 pm, "J. D." wrote:
>
> Any ideas of what I might be doing wrong?
You're not using update_all correctly - check the documentation
Fred
>
> This still has been a great day because even though I've seen tons of
> errors, I'm learning..
>
> --
> Posted viahttp://www.ruby-forum.com/
Frederick Cheung wrote:
>
> Does Scraper need to be an activerecord class at all ? you could pass
> to it the class whose table needs to be updated ie
>
> def do_something(some_klass)
> some_klass.update_all(...)
> end
>
> or perhaps you might want to couple things a little more loosely
>
>
On Jun 7, 8:30 pm, "J. D." wrote:
> I think I found my own answer to the last question - a single class
> cannot inherit across multiple classes. :(
>
Does Scraper need to be an activerecord class at all ? you could pass
to it the class whose table needs to be updated ie
def do_something(some
I think I found my own answer to the last question - a single class
cannot inherit across multiple classes. :(
--
Posted via http://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rai
Another thing I considered is inheritance.
If I do
class Scraper < RushingOffenses then the RushingOffenses class located
in the rushing_offense.rb model would inherit it. Then I could possibly
put the following in my rake task:
offensive_rushing = RushingOffense::Scraper.new
However, I wou
To add another thought to the mix:
The only reason why I'm defining a rake task is that eventually the rake
task will be managed by a cron job for populating the data for my
database on a weekly basis (say every sunday night).
The main bulk of the remainder of my project will just be dealing w
To expand upon the issue:
There are approximately 37 different categories for College Football
that house statistics. I will be parsing 37 different URLs to pull and
retrieve data that will be pushed to my database. The Scraper class is
the tool for doing that.
Each call within my rake task
17 matches
Mail list logo