Form_for only for single-form pages? (ignore previous)

Howdy, I’m new to rails and I’m learning form Agile Web Dev with Rails.
It seems all of the examples that use form_for use it in situations
where the action first creates a new object before doing a
request.post…

If I’m in a situation where I’m managing Roles, Rights, and assignments
of rights to roles, I may want to have one little form with a text field
and a “Create Role” button, another little form with a text field and a
“Create Right” button, etc… in those situations is there a use for a
form_for at all? An action can’t presuppose that I’m going to be using
either or, so should I just create separate actions to invoke from the
separate forms (ex ‘create_new_role’, ‘create_new_right’, etc) using
form_tag and then redirect :back?

(Sorry, on my previous post I accidentally said “form_tag” in the topic
and it doesn’t let me edit… so I reposted.)

On Feb 13, 8:47 am, Dave S. [email protected]
wrote:

If I’m in a situation where I’m managing Roles, Rights, and assignments
of rights to roles, I may want to have one little form with a text field
and a “Create Role” button, another little form with a text field and a
“Create Right” button, etc… in those situations is there a use for a
form_for at all? An action can’t presuppose that I’m going to be using
either or, so should I just create separate actions to invoke from the
separate forms (ex ‘create_new_role’, ‘create_new_right’, etc) using
form_tag and then redirect :back?

You definitely want the one form to POST to /roles and the other to
POST to /rights, but I’m not sure how that precludes you from using
form_for.

Perhaps you haven’t noticed that a form_for uses a block that has a do
and an end? So you just create the first form with form_for do …
end and then create the next form with form_for do … end.

You can have as many forms as you like on a single page.

Ciao,
Sheldon.