A common problem that appears in the book support queue for Simply Rails 2 is the issue of randomizing the story link.
In the book the code is:
But a lot of readers claim it should be:Code:class StoriesController < ApplicationController def index @story = Story.find(:first, :order => 'RANDOM()') end end
'RANDOM()' is correct for SQLite3 (which the book uses) and 'RAND()' is correct for MySQL.Code:class StoriesController < ApplicationController def index @story = Story.find(:first, :order => 'RAND()') end end
I've found a patch that was submitted recently to deal with this very issue:
http://rails.lighthouseapp.com/proje...#ticket-1274-1
Hope that helps.




Bookmarks