Forum: Ruby on Rails Advice needed on tracking down unusual error

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Lindsay B. (Guest)
on 2006-04-06 17:08
Does anyone have advice on how to go about locating the cause of this
error message:

ActionView::TemplateError (wrong number of arguments (3 for 1)) on line
#4 of app/views/products/search.rhtml:
4: <%= start_form_tag :action => 'search' %>

I don't see anything wrong with line 4 above.

Some background: I've made a number of changes to Controllers, Layouts,
Views and Models in my app so it is going to be very difficult to back
track and find where the app started to fail. I've a feeling this error
is possibly caused by bad formating in my code somewhere. Given this,
what is the best approach to finding the bug?

thanks
-Lindsay
Alan F. (Guest)
on 2006-04-06 17:15
Lindsay B. wrote:
> Does anyone have advice on how to go about locating the cause of this
> error message:
>
> ActionView::TemplateError (wrong number of arguments (3 for 1)) on line
> #4 of app/views/products/search.rhtml:
> 4: <%= start_form_tag :action => 'search' %>
>
> I don't see anything wrong with line 4 above.

I'd:

1) look at the HTML source generated if you take the line out, see if
you can spot anything weird

2) try :url => { :action => 'search' }, just in case.

Alan
Alan F. (Guest)
on 2006-04-06 17:16
Alan F. wrote:
> Lindsay B. wrote:
>> Does anyone have advice on how to go about locating the cause of this
>> error message:
>>
>> ActionView::TemplateError (wrong number of arguments (3 for 1)) on line
>> #4 of app/views/products/search.rhtml:
>> 4: <%= start_form_tag :action => 'search' %>
>>
>> I don't see anything wrong with line 4 above.
>
> I'd:
>
> 1) look at the HTML source generated if you take the line out, see if
> you can spot anything weird
>
> 2) try :url => { :action => 'search' }, just in case.
>
> Alan

By take the line out, I actually mean replace it with a literal <form
method="post" action="/controller/search">

:-)

Alan
Lindsay B. (Guest)
on 2006-04-06 17:24
Alan F. wrote:
>replace it with a literal <form method="post" action="/controller/search">

Thanks for the advice, Alan. I tried that and now I have:

ActionView::TemplateError (wrong number of arguments (2 for 1)) on line
#13 of app/views/products/search.rhtml:
10: <center>
11:     <p><label for="search">UPC/Tag</label>
12:     <%= text_field 'search', 'search', :size => '30', :maxsize =>
'41' %>
13:     <%= submit_tag 'search' %>

So looks like something is badly screwed up!

-Lindsay
David T. (Guest)
on 2006-04-06 17:26
(Received via mailing list)
Should line 12 be:

<%= text_field 'search', 'search', { :size => '30', :maxsize => '41' }
%>

?

HTH
David
Lindsay B. (Guest)
on 2006-04-06 17:31
David T. wrote:
> Should line 12 be:
>
> <%= text_field 'search', 'search', { :size => '30', :maxsize => '41' }
> %>
>
> ?
>
> HTH
> David

Yes, you're right - options in {}, but that isn't causing this error.
It's as though I've somehow broken the form methods for my app.

- Lindsay
Hampton (Guest)
on 2006-04-06 17:33
(Received via mailing list)
I don't think anything is badly screwed up.

I have a theory that there is an unclosed erb line above.

Some <%= that never hits a %>... or some <%= function('stuff' %> who
never
hits a parenthesis.

Just a theory.

-hampton catlin.
Lindsay B. (Guest)
on 2006-04-06 17:37
Alan F. wrote:

>> 2) try :url => { :action => 'search' }, just in case.

Tried this, but still get the same error.

-Lindsay
Lindsay B. (Guest)
on 2006-04-06 17:38
Hampton wrote:
> I don't think anything is badly screwed up.
>
> I have a theory that there is an unclosed erb line above.
>
> Some <%= that never hits a %>... or some <%= function('stuff' %> who
> never
> hits a parenthesis.
>
> Just a theory.
>
> -hampton catlin.

I think you are right. Is there an easy way to locate this, or do I need
to step through the code by hand?

-Lindsay
Lindsay B. (Guest)
on 2006-04-06 17:44
>Is there an easy way to locate this

I've just a grepped | wc -l on the ERB tags: 902 open, 901 closed, so I
guess I have to find the extra or missing tag!

-Lindsay
Hampton (Guest)
on 2006-04-06 17:51
(Received via mailing list)
Ouch! But good work with the unix command!

I would say that, knowing processors, it probably is just north of where
you
are getting that error.

-hampton.
This topic is locked and can not be replied to.