[Rails] Re: Undefined Method error when creating method for collection of objects

2009-04-03 Thread Frederick Cheung
On Apr 3, 12:37 am, Rick wrote: > Hi Frederick, > > Once again thankyou for taking the time to respond. > > I am a little confused by your response. > > Your method seems to suggest that I pass an argument/array into the > method. > > @phonecalls should already contain all of the array data, no

[Rails] Re: Undefined Method error when creating method for collection of objects

2009-04-02 Thread Rick
Hi Frederick, Once again thankyou for taking the time to respond. I am a little confused by your response. Your method seems to suggest that I pass an argument/array into the method. @phonecalls should already contain all of the array data, no? Why do I need to pass this in. Cant I just create

[Rails] Re: Undefined Method error when creating method for collection of objects

2009-04-02 Thread Frederick Cheung
On Apr 2, 2:00 pm, Rick wrote: > On Apr 2, 11:59 am, Frederick Cheung > wrote: > > Hi Fred thnaks for your time. > > I thought that I had created a class method in the (phonecall class) . > Do you mean in the array class? And how do I do that. Is it not No. (well technically you could create

[Rails] Re: Undefined Method error when creating method for collection of objects

2009-04-02 Thread Rick
Hi Matt, Thanks for your time. I thought that by putting my total_cost method in the phonecall model that I was doing exactly that. I appreciate that I can use the view shortcut so thanks for that tip. I do need to understand how to create methods that act upon an array of objects both in this i

[Rails] Re: Undefined Method error when creating method for collection of objects

2009-04-02 Thread Rick
On Apr 2, 11:59 am, Frederick Cheung wrote: > On 2 Apr 2009, at 11:35, Rick wrote: > > > > > Hi I am learning rails and have hit a bit of a wall. > > > I have created methods previousley that work fine on a single object. > > However in my latest project I am trying to calculate the total cost

[Rails] Re: Undefined Method error when creating method for collection of objects

2009-04-02 Thread Matthew MacLeod
On 2 Apr 2009, at 11:59, Frederick Cheung wrote: >> In my controller I am finding the @phonecalls >> And in my view I want to say @phoncalls.total_cost >> > The easiest way is probably to create a class method that takes as an > argument the array and returns the total cost. You could also run in

[Rails] Re: Undefined Method error when creating method for collection of objects

2009-04-02 Thread Frederick Cheung
On 2 Apr 2009, at 11:35, Rick wrote: > > Hi I am learning rails and have hit a bit of a wall. > > I have created methods previousley that work fine on a single object. > However in my latest project I am trying to calculate the total cost > of a group of phonecalls and I am having difficulty cre