Displaying 2 results from an estimated 2 matches for "someperson".
2006 Feb 06
7
Delaying initialization of associations until first access
Guys,
Say I have the following:
-----
class Person < ActiveRecord::Base
has_one :house
end
class House < ActiveRecord::Base
belongs_to :person
attr_accessor :color
end
-----
Then I have the following code:
-----
john = Person.new
john.house.color = "Blue"
john.save
-----
What I would like to have happen, is that on first call to john.house, if
house hadn''t been
2005 Dec 16
13
How to pass a collection to paginate?
There must be a better way to write this code:
@project_pages, @projects= paginate :project,
:per_page => 10,
:conditions => ["account_id = ?", account]
?!
If only I could pass the sub-collection
account = ...
@projects = account.project
to paginate, instead of letting it extract it with a find :all + sql
conditions
Alain.
--
Posted via