<%= STATES[location.state.to_sym] %> ?

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)



On Wed, Jan 21, 2009 at 4:06 PM, Sav <[email protected]> wrote:
>
> I inherited an app that created STATES & COUNTRIES as global hashes in
> config/environment.rb
>
> STATES = {}
> STATES[:AL] = 'Alabama'
> STATES[:AK] = 'Alaska'
> STATES[:AZ] = 'Arizona'
> ...
>
> I'm able to render the name correctly like this...
> <%= STATES[:AK] %>
>
> But what is the syntax to call that dynamically?  This does not
> work...
> <%= STATES[location.state] %>
>
> Thanks, I'm stumped on this noob issue.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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