Posted almost 12 years ago. Visible to the public.

Use form_for without the enclosing form tag

In rare cases you might need something like form_for Archive (for using form builder methods on the resulting block element) but without the surrounding form. One such case would be updating some of a form's fields via XHR.

You can simply use Rails' fields_for to do things like this in your views (HAML here):

- fields_for @user do |form| = form.label :email, 'E-Mail' = form.text_field :email

You will only receive the form content you gave, no hidden inputs including the authenticity token etc.

Your development team has a full backlog of feature requests, chores and refactoring coupled with deadlines? We are familiar with that. With our "DevOps as a Service" offering, we support developer teams with infrastructure and operations expertise.

Owner of this card:

Arne Hartherz
Last edit:
about 1 year ago
by Arne Hartherz
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Arne Hartherz to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more