This seems very simple, but I can't quite get it. Probably because I'm
just starting out with RoR.

My view has a slew of labels and text fields; many are "required":

<%= f.text_field :screen_name %> <span class="required_field">Required
field</span>

(The "required_field" class turns the text red and smaller.) I'd like
to not have everything between <span> and </span> sitting at the end
of every required line. I'd like instead to use a variable:

<% req = "<span class='required_field'>Required field</span>" %>

And then have
<%= f.text_field :screen_name %> <%= req %>

Shorter and DRYer. But when I do that, I get my HTML printed to the
screen, not interpreted.

Help appreciated. Thanks!
Jacob

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to