mtay
mtay

Reputation: 1316

how to use form_tag in rails 2.3

Hey all, I'm running into an error using form_tag in Rails 2.3 and can't seem to wrap my head around it. What may I be doing wrong syntactically?

      =form_tag :action => 'form', :name => "admin_form" 
        #images_actions_bar
          =submit_tag "Approve", :class => "button", :name => "approve"
          =submit_tag "Update", :class => "button", :name => "update"

I am seeing "syntax error, unexpected kENSURE, expecting $end"

Upvotes: 2

Views: 1769

Answers (2)

Ryan Bigg
Ryan Bigg

Reputation: 107728

This is because you're using the = output when you're using Rails 2. This is the new helper in Rails 3. You want to use - for the form_tag in Rails 2.

EDIT: OP pointed out in the comments that he was missing a do at the end of the form_tag as well.

Upvotes: 2

ScotterC
ScotterC

Reputation: 1064

If you must have a multi-button form then I would take a look at Ryan Bate's RailsCast on the subject: http://railscasts.com/episodes/38-multibutton-form

Upvotes: 1

Related Questions