This page is READ-ONLY. It is generated from the old site.
All timestamps are relative to 2013 (when this page is generated).
If you are looking for TeX support, please go to VietTUG.org

ruby on rails: instance method vs. class method

Added by over 3 years ago

Resource

  1. Instance vs. Class
  2. Include vs Extend

If you need to destroy an object, you call object.destroy. Then destroy is an instance method.

Some methods are called on the class itself, for example ActiveRecord::Base#find, and they are class method.

If you need add methods to a class, use "Extend". In short,

Class Instance
Extend Include
object.new.destroy object.find

Comments