Multiple classes on form text_field

Consider :


<% form_for(@z) do |f| %>
<%= f.error_messages %>

<%= f.label :x %>
<%= f.text_field :x, :class => 's' %>

<%= f.submit 'Update' %>

<% end %>

The above form works fine. What I want to do is have two classes, s and
t, associated with text_field :x.

The following does not work.


<% form_for(@z) do |f| %>
<%= f.error_messages %>

<%= f.label :x %>
<%= f.text_field :x, :class => {'s', 't'} %>

<%= f.submit 'Update' %>

<% end %>

The code above will generate a single class class=“st”

How can I have two classes in the same field using form helper? Do I
have to generate my own html?

Hi Ralph,

Have you tried this:

<%= f.text_field :x, :class => ‘s t’ %>

Regards,

Saurabh