Ben Bleything
10/9/2006 4:51:00 PM
On Tue, Oct 10, 2006, Dark Ambient wrote:
> I googled around on this one but found nothing. Anyone know what these
> error means ?
It means exactly what the exception says. You can't call gsub on a
symbol.
> I'm trying to use it in a form field :
>
> <%= text_field(:search,:city.gsub(/\s/, "''")) %></fieldset>
That doesn't do what you think it does.
text_field takes two arguments, the first is the object it represents,
and the second is the attribute of that object that the value will be
saved into/pulled out from.
It seems that you want to massage that value before it gets inserted
into the form field, right? Or is it after it gets saved?
In the former case, you can (probably!) specify a value manually, like
so:
<%= text_field :search, :city, :value => @search[:city].gsub(/\s/, "''") %>
In the latter case, do this in your model.
Ben