I'm using Rails 1.2 RC2 and I've got a view that uses form_tag and the
form is not being rendered. It's just not there. My view is this:
<div class="box">
<fieldset>
<legend>Log in</legend>
<% form_tag do %>
<div class="row">
<div class="formfield">
<label for="sso_id">SSO ID:</label>
<%= text_field_tag :sso_id, params[:sso_id] %>
</div>
</div>
<div class="row">
<div class="formfield">
<label for="password">Password:</label>
<%= password_field_tag :password, params[:password] %>
</div>
</div>
<%= submit_tag "Login" %>
<% end %>
</fieldset>
</div>
My browser output is this:
<div class="box">
<fieldset>
<legend>Log in</legend>
</fieldset>
</div>
As you can see, it's just not there. Do I have an error in my view or
is there a problem with form_tag in the latest release candidate?
Rick_Olson
(Rick Olson)
January 18, 2007, 4:48am
2
It should be using the block's binding to output, so that isn't
necessary. I don't even think the erb will parse correctly.
Are you sure you're using the right gem? This sounds like you're
still on 1.1.6.
That is incorrect[1][2]. An exception will be thrown
If I do the following:
<%= form_tag %>
form fields....
</form>
the opening form tag is not rendered. So it appears form_tag is not
doing anything.
[1]http://www.loudthinking.com/arc/000601.html
[2]Ruby on Rails — Rails 1.2 RC1: New in Action Pack
I ran into problems like this when migrating to 1.2rc1 -- if I recall correctly the problem was that my environment configuration still claimed to be 1.1.6. Have you updated rails within the app?
-faisal
Crikey. I totally forget to check the RAILS_GEM_VERSION environment
variable. I commented out the line
RAILS_GEM_VERSION = '1.1.6'
in my environment.rb and lo and behold everything works fine.
Con
(Con)
January 19, 2007, 12:15am
6
Hi, you can also do the following:
RAILS_GEM_VERSION = '1.1.6.xxxx' where xxxx is the revision number.
e.g.
RAILS_GEM_VERSION = '1.1.6.5959'
I wouldn't recommend commenting something out that my be referenced by
other parts of the rails system. After updating this file, then you
should perform the following action:
rake rails:update
Good luck,
-Conrad