Saturday, October 16, 2010

[Rails] Doubt with symbols in Rails

I was trying to write a wrapper for number_to_currency to return
currency in pounds. I used a helper class to do this.

def number_to_pounds(amt)
number_to_currency(amt, :unit => "£")
end

This works fine, but I am trying to understand why I can't use a
symbol to pass the values. I thought symbols were like pointers. (you
now know I am a newbie).


def number_to_pounds(:amt)
number_to_currency(:amt, :unit => "£")
end

Note - amt is not the name of the variable my view works on, it is
price, so I tried the symbol :price, it wouldn't work either. I am
googling to learn about the symbols. Any link for that would be really
helpful.

Thanks

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate