Closed gjp closed 13 years ago
Just a few minor changes and I think we'll be ready to merge:
These lines in the migration can be simplified:
Puzzle.where("released_on <= ?", Date.today).update_all(:published => true)
Puzzle.published
no longer needs to take into account the released_on date. So it can be re-written to:
def self.published(user=nil)
if user && (user.draft_access || user.admin)
self
else
where(:published => true)
end
end
Hope that helps. Thanks for working on this!
Cool, I didn't know about those shortcuts. Need more experience with Rails 3.
Just to confirm: You wish to allow puzzles with a future release date to be visible if published = true? In that case I should also remove or reverse one of the integration tests.
Just to confirm: You wish to allow puzzles with a future release date to be visible if published = true? In that case I should also remove or reverse one of the integration tests.
Ah yes I meant to mention that. Update the tests as well. Thanks!
Updated with suggested changes.
Thanks for working on this Gregory!
Please review. I'm still kind of new to this workflow, so I figured I'd start small and ask for feedback, the pickier the better.
Tested against Ruby 1.9.3p0, Rails 3.1, Postgres 8.4.
One more thing - I found rake db:test:prepare necessary on a fresh clone. Should this be mentioned in the README, or did I miss a step?
Thanks!