SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Zealot ricklach's Avatar
    Join Date
    Nov 2004
    Location
    Victoria BC
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Retrieving String Value from method

    I have a method that I use to create simple drop-down boxes. On bit of code from that method is:
    Code:
    COMMITMENT = [
    		[ "Very Interested", 1 ],
    		[ "Somewhat Interested", 2 ],
    		[ "Interested", 3 ],
    		[ "Not Very Interested", 4 ],
    		[ "Uninterested", 5 ]
    		].freeze
    The integer value is stored in the db. I want to show the string value in a view page. Is there some syntax that will allow me to do that - something like
    Code:
    <%= method:COMMITTMENT.commitment_id %>
    where commitment_id=1, would give me "Very Interested".

    Rick
    Ruby, Ruby when will you be mine

  2. #2
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •