On 2/19/07, Mike Dershowitz
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> 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!
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.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---