[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: error: private method `gsub' called for :city:Symbol

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

1 Answer

jg

10/11/2012 7:54:00 AM

0

On 11/10/2012 7:31 AM, Torpedo wrote:
> "jg" <jg@nospam.com> wrote in message
> news:U2nds.2$Ow3.1@viwinnwfe02.internal.bigpond.com...
>> http://au.news.yahoo.com/thewest/a/-/breaking/15089961/power-bill-shor...
>>
>>
>> "Tony Abbott's use of a Holocaust survivor's soaring WA power bill for
>> a fresh attack on the carbon tax has blown a fuse.
>>
>> The Opposition Leader brandished pensioner Hetty Verolme's latest
>> Synergy bill for $1563 to cover from June 9 to August 6, which
>> included the start of the carbon tax on July 1.
>>
>> Ms Verolme's bill for the previous two months was $736 and Mr Abbott
>> blamed 70 per cent of the $800 increase on the carbon tax.
>>
>> But the rise was largely because she increased her energy use in
>> winter. The bill clearly shows her consumption effectively doubled."
>>
>>
>> How many others are duped into letting that moron do their thinking
>> for them?
>>
>> WA 'had' an energy efficiency program before the Barnett govt axed it.
>> Then libs have the gall to blame the fed govt for your power bill.
>>
>
> ...Well, that's the quality of Australian Rhodes scholars.


He might be alright in the field in which he actually studied, just a
midget everywhere else.