I'm making a very simple website with ROR.
class Product < ActiveRecord::Base
belongs_to :category
has_many :photos
has_many :ordered_photos,
:class_name => 'Photo',
:order => 'name'
has_one :random_photo_1,
:class_name => 'Photo',
:order => 'RAND()'
def random_photo_2
Photo.find(:first, :conditions => { :product_id => self.id }, :order => 'RAND()')
end
end
During implementing many classes of ActiveRecord, I get doubt, I don't understanding what it's the different between random_photo_1 implementation a random_photo_2 method.
P.S. I'm sorry for my english.