Muhammad Ishaq
2008-Feb-12 09:59 UTC
how to access constant array of a model inside a view
Hello All, I have this array (of, say User''s contact preferences) inside the User model. CONTACT_PREFERENCES = ["Email", "Mobile Phone", "Residence Phone", "Office Phone", "Fax"] and inside the view (when registering a new user) I have to show them inside a combo (or a list of check boxes), but when I do something like this User::CONTACT_PREFERENCES.each { } it gives me Symbol as array index any ideas how I should achieve a similar effect, Thanks in advance. -- Ishaq http://blogs.kahaf.com/ishaq - Programming can be fun, so can be cryptography, however they should not be combined ... --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Muhammad Ishaq
2008-Feb-12 19:00 UTC
Re: how to access constant array of a model inside a view
hmm, does that mean there is no way to do it? On Feb 12, 2008 2:59 PM, Muhammad Ishaq <ishaq.malik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello All, > > I have this array (of, say User''s contact preferences) inside the > User model. > > CONTACT_PREFERENCES = ["Email", "Mobile Phone", "Residence Phone", "Office > Phone", "Fax"] > > and inside the view (when registering a new user) I have to show them > inside a combo (or a list of check boxes), but when I do something like this > > User::CONTACT_PREFERENCES.each { } > > it gives me > > Symbol as array index > > > any ideas how I should achieve a similar effect, Thanks in advance. > > -- > Ishaq > http://blogs.kahaf.com/ishaq > > - Programming can be fun, so can be cryptography, however they should not > be combined ...-- Ishaq http://blogs.kahaf.com/ishaq - Programming can be fun, so can be cryptography, however they should not be combined ... --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---