Revision: 57699
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 6, 2012 21:46 by akmuraro
Initial Code
def self.random ids = connection.select_all("SELECT id FROM paragraphs WHERE length = 1") find(ids[rand(ids.length)]["id"].to_i) unless ids.blank? end
Initial URL
Initial Description
in your model, add a def to pick a record where an option (in my case lenght) is equal to 1
Initial Title
Pick a random element
Initial Tags
Initial Language
Rails