18
class Test
def self.who_is_self
p self
end
end
Test.who_is_self
output:
Test
Now if you want a Rails specific solution, it's called named_scopes:
class Post < ActiveRecord::Base
named_scope :cool, :conditions => { :name => 'cool' }
end
Used like this:
Post.cool