# Damn Newbie! Multiple arguments to model method

**URL:** <https://www.ruby-forum.com/t/damn-newbie-multiple-arguments-to-model-method/85978>\
**Category:** Rails\
**Created:** [February 18, 2007, 3:56pm UTC](https://www.ruby-forum.com/t/damn-newbie-multiple-arguments-to-model-method/85978 "2007-02-18T15:56:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![miked](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@miked](https://www.ruby-forum.com/u/miked)\
**Post date:** [February 18, 2007, 3:56pm UTC](https://www.ruby-forum.com/t/damn-newbie-multiple-arguments-to-model-method/85978/1 "2007-02-18T15:56:02Z")

</div>

Hi:

I’ve been working with rails for a couple of months now. And I was  
getting pretty confident and feeling pretty good about how i was  
proceeding. Every once in a while though, I try and do something that  
keeps me humble, and reminds me that I’m still just a newbie.

Why doesn’t this work in my model:

def self.complete\_task(tid, uid)  
@taskhist = taskhist.new  
@taskhist.task\_id = gid  
@taskhist.entity\_id = uid  
@taskhist.timeperiod\_id = 7  
@taskhist.task\_meas = Taskhist.find(:first, :conditions =\> “task\_id  
= #{tid}”).goal\_meas  
@taskhist.taskhisttype\_id = 3  
@taskhist.save!  
end

when I try and call from the console or from my controller. For some  
reason, I get an argument 1 for 2 error. Can model methods only take 1  
parameter in rails? If that’s the case, what’s my work around?

Thanks so much in advance!

Mike

---

<div class="post-metadata">

**Author:** ![miked](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@miked](https://www.ruby-forum.com/u/miked)\
**Post date:** [February 18, 2007, 4:14pm UTC](https://www.ruby-forum.com/t/damn-newbie-multiple-arguments-to-model-method/85978/2 "2007-02-18T16:14:38Z")

</div>

On 2/19/07, Mike D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> def self.complete\_task(tid, uid)  
> when I try and call from the console or from my controller. For some  
> reason, I get an argument 1 for 2 error. Can model methods only take 1  
> parameter in rails? If that’s the case, what’s my work around?
> 
> Thanks so much in advance!

Hi Mike,

Take a look at the stack trace if you have one. There’s a lot of very  
useful info in there normally. “1 for 2” means you’re giving  
something 1 argument when it takes 2. Since you haven’t posted the  
error message, I can’t tell what that method is, but I’ll take a wild  
stab that you’re calling #complete\_task with 1 argument, when it  
appears to take 2.

Regards,  
George.
