Undefined method form_for?

Seems the only issues I ever have with Rails are these bizarre fiddly
little things that make no sense.

Can’t for the life of me understand why I’m getting undefined method on
form_for in a view?

And it’s actually part of the acts_as_authenticated plugin that’s doing
it. But how can it not know about form_for?

On 4/24/06, meltman [email protected] wrote:

Seems the only issues I ever have with Rails are these bizarre fiddly
little things that make no sense.

Can’t for the life of me understand why I’m getting undefined method on
form_for in a view?

And it’s actually part of the acts_as_authenticated plugin that’s doing
it. But how can it not know about form_for?

Can you send over some code that isn’t working for you?

Wilson B. wrote:

Can you send over some code that isn’t working for you?

Yep, dies on line 1:

<% form_for :user, @user do |f| -%>

The controller executes only one line:

@user = User.new(params[:user])

That’s it. Totally boggled. I should know better perhaps than to work on
this sort of thing late in the evening. I’m sure it’s something obvious,
but it just makes no sense to me right now.

On 4/24/06, meltman [email protected] wrote:

That’s it. Totally boggled. I should know better perhaps than to work on
this sort of thing late in the evening. I’m sure it’s something obvious,
but it just makes no sense to me right now.

form_for creates a tag, so that needs to be:
<%= %>, not <% %>.

Wilson B. wrote:

form_for creates a tag, so that needs to be:
<%= %>, not <% %>.

Actually no it’s not. According to the API docs:

“Worth noting is that the form_for tag is called in a ERb evaluation
block, not a ERb output block. So thatâ??s <% %>, not <%= %>.”

And changing it to <%= just yields a pile of syntax errors.

The mystery continues.

On Apr 24, 2006, at 8:50 PM, Wilson B. wrote:

And changing it to <%= just yields a pile of syntax errors.
-%>
<% end -%>

form_for require rails 1.1 or better. You can’t run acts_as_auth on
1.0 by default anymore because of form_for.

-Ezra

Ezra Z. wrote:

form_for require rails 1.1 or better. You can’t run acts_as_auth on
1.0 by default anymore because of form_for.

-Ezra

That’d be it. Son of a…bleep!

Thanks. Guess it’s time to upgrade. Wish the API docs specified that,
might’ve saved me hours of head banging.

On 4/24/06, meltman [email protected] wrote:

The mystery continues.

Sorry; too much/not enough wine. (Depends on perspective.)

What happens when you do:
<% form_for :user, @user, :url => {:action => ‘some_action’} do |f| -%>
<% end -%>

?