SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2005
    Posts
    485
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [rails] Conatenating Symbols

    [edited: title should be Concatenating Symbols - sorry for the typo]

    hi all,

    i'm using the rails form helpers to display a select list.

    as i'm sure most know, the form helpers take symbols. it is easy to display a column value in the select list, however, i want to concatenate several columns for display purposes.

    this isn't so obvious.

    does anyone know how i can concatenate multiple column values with a row so that the symbol used in the form helpers will display it?

    tia...

    ps - i guess i could add another column that contains the concatenated value, but that seems like a less than stellar solution.
    Last edited by skeeterbug; Jan 9, 2007 at 01:38. Reason: typo

  2. #2
    SitePoint Guru Majglow's Avatar
    Join Date
    Aug 1999
    Location
    B-Town
    Posts
    645
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The form helpers take strings too. So you can just work with strings. Symbols shouldn't be concatenated, because then that would defeat the purpose of using symbols.

    Symbols are not strings.
    Ohai!

  3. #3
    SitePoint Evangelist
    Join Date
    Apr 2005
    Posts
    485
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Majglow View Post
    The form helpers take strings too. So you can just work with strings. Symbols shouldn't be concatenated, because then that would defeat the purpose of using symbols.

    Symbols are not strings.
    does that mean i can create a variable with the concatenated text value i want and to_s it?

    i can't see how else to do it. hard coding one string would only allow that string to be displayed - and there are multiple options depending on user input.

    tia...

  4. #4
    SitePoint Guru Majglow's Avatar
    Join Date
    Aug 1999
    Location
    B-Town
    Posts
    645
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess I don't understand what you mean.
    Ohai!


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
  •