Multiple select listboxes in Rails

Since I think the documentation is lacking and I always have to rely on Stackoverflow every time I want to use it, I keep this a remind-me-note:


<%= :user,
      User.all,   # The object list
      "id",       # get this attribute as key
      "email",    # SHow this in listbox
    {}, #html attributes, empty here
      :size => 5, 
    } # "select" options

Now we can all wonder why this simple example isnt in the documentation…….

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.