Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I can reproduce it reliably by first following a has_many relationship, then adding a scope to that. Adding a where clause (directly or inside of a class method like in Github's example: it's the same thing) is okay. Also the scope must filter on the same column as the foreign key. So this wouldn't cause a problem: `scope :recent, lambda { where("created_at > ?", Time.now.utc - 1.week) }`.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: