class Post < ActiveRecord::Base def self.cool_post self.find_by_name("cool") end end
你可以用irb轻松测试这些信息:
class Foo def self.bar puts self.inspect end end Foo.bar # => Foo