Rails form_tag

http://destiney.com/blog/rails-form-tag

Consider the api definition for form_tag:

form_tag( url_for_options = {},
          options = {},
          *parameters_for_url,
          &proc)

This form_tag:

<%= form_tag( :action => 'upload',
              :multipart => true ) %>

Produces this:

<form action="/home/upload?multipart=true"
method="post">

which is probably not what you want.

Try this instead:

<%= form_tag( { :action => 'upload' },
                :multipart => true ) %>

and you'll get this:

<form action="/home/upload"
enctype="multipart/form-data" method="post">

You have to establish when your first hash of parameters ends, otherwise form_tag will assume your :action and your :multipart option are a single hash, when :multipart really needs to go in the second hash.

你可能感兴趣的:(Blog,Rails,Go)