pjb3 (owner)

Revisions

gist: 220733 Download_button fork
public
Public Clone URL: git://gist.github.com/220733.git
Embed All Files: show embed
active_record_swiss_army_finder.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
def self.[](*args)
  if args.size > 1
    args.map{|e| self[e] }
  else
    case arg = args.first
    when Integer then find(arg)
    when String then find_by_string(arg)
    when self then arg
    else first(arg)
    end
  end
end