HI all, I have an AR doing the following : class Home < ActiveRecord::Base has_many :home_milestone def home_milestone_last_update hm = Home::find_by_sql ["SELECT MAX(updated_on) as last_update FROM home_milestones WHERE home_id = ?", id] return hm[0].last_update unless hm.size == 0 end #def home_milestone_last_update end This give me usage : irb> h.home_milestone_last_update => "2005/11/21 16:02:46" What i''d like to have is this usage (notice the ''.'' instead of ''_'' : irb> h.home_milestone.last_update => "2005/11/21 16:02:46" Does my request place the functionality under the HomeMilestone class then? What does that look like? Am I walking downt the path to insanity? Thanks all. -- Peter Fitzgibbons _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On Monday 21 November 2005 22:08, Peter Fitzgibbons wrote:> HI all, > > I have an AR doing the following : > > class Home < ActiveRecord::Base > > has_many :home_milestone > > def home_milestone_last_update > hm = Home::find_by_sql ["SELECT MAX(updated_on) as last_update FROM > home_milestones WHERE home_id = ?", id] > return hm[0].last_update unless hm.size == 0 > end #def home_milestone_last_update > > end > > This give me usage : > irb> h.home_milestone_last_update > => "2005/11/21 16:02:46" > > What i''d like to have is this usage (notice the ''.'' instead of ''_'' : > > irb> h.home_milestone.last_update > => "2005/11/21 16:02:46" > > Does my request place the functionality under the HomeMilestone class > then? What does that look like? Am I walking downt the path to > insanity?Make a Milestone class?> Thanks all. > > > -- > Peter Fitzgibbons-- Dominic Marks