Triple Entendre Soup
About
ADD Soup!
Accounts
My stream
My TV
My friends
Newer posts are loading.
You are at the newest post.
Click here
to check if anything new just came in.
March
26
2010
16:29
the { buckblogs :here }: Helping ActiveRecord finders help you
class Thing < ActiveRecord::Base def self.find(*args) if args.first.to_s == "random" ids = connection.select_all("SELECT id FROM things") super(ids[rand(ids.length)]["id"].to_i) else super end end end
Tags:
ror
rails
activerecord
random
best-practices
#
React
← Front page