newscloud/n2 — comment on commit 524eb0dc0db4e8c2c67d54c957de78994730a37b
File: app/models/item_score.rb line 34
By joevandyk:

I changed the ranking code to check for the existence of the
item.created_at, btw.

187) User#when there is a valid user should return the user name for to_s
Failure/Error: Unable to find matching line from backtrace
NoMethodError:
undefined method `created_at' for
#
# ./app/models/item_score.rb:36:in `calc_item_score'
# ./app/models/item_score.rb:65:in `update_score!'
# ./app/models/item_score.rb:60:in `find_or_create_and_score'
# ./lib/acts_as_moderatable.rb:32:in `rescore_item'
# ./app/models/feed.rb:32:in `add_default_feed!'
# ./db/seeds.rb:200
# ./db/seeds.rb:45:in `each'
# ./db/seeds.rb:

is an example of a test failure without the created_at check.

On Mon, Jan 16, 2012 at 12:03 PM, Russell Branca <
reply@reply.github.com
> wrote:

> There shouldn't be any models in the system without a created_at
> field, if there are, that's a bug. Also, we're restricting to only
> using these models for rankings:
>
> ["PredictionGuess", "Question", "Idea", "Forum", "Event",
> "PredictionGroup", "IdeaBoard", "Gallery", "Resource", "Classified",
> "PredictionQuestion", "Card", "Content", "ResourceSection", "Article",
> "Topic", "Answer"]
>
> And I just double checked, all of those have a created_at field.
>
> I just grabbed a copy of your rails3-master-merge branch today and I'm
> diving into it. Let me see if I run into the same issue.
>
>
> On Mon, Jan 16, 2012 at 11:49 AM, Joe Van Dyk
>
> wrote:
> > Do all 'item' objects that can be scored *always* have a created_at
> attribute? The tests are failing here, because we are calling
> item#created_at on objects that don't have a created_at method.
> >
> > ---
> > Reply to this email directly or view it on GitHub:
> >
> https://github.com/newscloud/n2/commit/524eb0dc0db4e8c2c67d54c957de78994730a37b#commitcomment-871860
>
> ---
> Reply to this email directly or view it on GitHub:
>
> https://github.com/newscloud/n2/commit/524eb0dc0db4e8c2c67d54c957de78994730a37b#commitcomment-871904
>