Topic: Form has suddenly stopped working

This really has me stumped.. I have a view with a form full of text fields, text areas, etc to create a new record which has been working just fine for days. Now, suddenly and without anything being changed, it's not happy with my text_field tags!!

This is the first text_field on the page and therefore is the first to throw errors:

<p>Title<br />
<%= text_field :newsletter, :title, :class => "fill" %></p>

Even without the :class => "fill" bit, it throws this error; wrong number of arguments (1 for 0).. !?

I'm so confused as to why it's suddenly decided to pack in. I've checked everything I can think of.. db connection's fine, the view is getting rendered with a @newsletter active record object, the log doesn't tell me anything.. everything looks like it should work and text_fields on other pages still work, just not this one.

Please help!! I'm ripping my hair out here! I just can't see why it would work fine one day and not the next.

Re: Form has suddenly stopped working

Well, I think i've found the culprit... I had a method i'd created in the model in question which was called send. I guess it wasn't happy with that. I've renamed it to send_newsletter and it works now. I guess 'send' is a reserved word?

Oh well. I've learnt my lesson.

Re: Form has suddenly stopped working

Reserved words are a pain. It's always a good idea to check words in this list before creating models/attributes.

Sometimes the site is down, like now apparently. In that case I usually type "rails reserved words" in Google then see the cached page.

Railscasts - Free Ruby on Rails Screencasts

Re: Form has suddenly stopped working

cheers for the link, ryan. I didn't realise the list of reserved words was so long!

Re: Form has suddenly stopped working

The primary reason being that every base class/method in Ruby can't be an model/attribute name because it will override the existing one in Ruby. I wish there was a convenient way to use namespacing to avoid this problem completely, but I'm sure it would have been done by now if it was easy.

Railscasts - Free Ruby on Rails Screencasts