Looking at: http://api.rubyonrails.org/ and search for find(), find() is
an instance public method. So why can we call Order.find(1) here?
Shouldn't it be Order.new.find(1)?
Looking at: http://api.rubyonrails.org/ and search for find(), find() is
an instance public method. So why can we call Order.find(1) here?
Shouldn't it be Order.new.find(1)?
This is an excellent question to pose to a rails-focused
audience. 'find' is obviously a class method, but maybe they use
special terminology in rails-land...
Carlo
···
Subject: how instance method is called
Date: lun 06 gen 14 06:41:33 +0100
--
* Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe
* di parlare tanto di amore e di rettitudine? (Chuang-Tzu)
Looking at: http://api.rubyonrails.org/ and search for find(), find() is
an instance public method. So why can we call Order.find(1) here?
Shouldn't it be Order.new.find(1)?
IMHO, It probably "extended" (not "included") that particular Module
that defines the #find method.
Abinoam Jr.
···
On Mon, Jan 6, 2014 at 4:25 AM, Carlo E. Prelz <fluido@fluido.as> wrote:
Subject: how instance method is called
Date: lun 06 gen 14 06:41:33 +0100
Quoting Warren Zhang (lists@ruby-forum.com):
I came across this code snippet from my reading:
require 'active_record'
class Order < ActiveRecord::Base
end
order = Order.find(1)
...
Looking at: http://api.rubyonrails.org/ and search for find(), find() is
an instance public method. So why can we call Order.find(1) here?
Shouldn't it be Order.new.find(1)?
This is an excellent question to pose to a rails-focused
audience. 'find' is obviously a class method, but maybe they use
special terminology in rails-land...
Carlo
--
* Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe
* di parlare tanto di amore e di rettitudine? (Chuang-Tzu)