Created
          April 19, 2013 15:17 
        
      - 
      
- 
        Save hzmangel/5421035 to your computer and use it in GitHub Desktop. 
    Select tag used in rails
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # Rails code | |
| # @foo = [1,2,3,4] | |
| = select_tag "foo", options_for_select(@foo), :prompt => "Please select a foo" | |
| # @bar is an collection of objects, each of which has key_method key and value_method val | |
| = select_tag "bar", options_from_collection_for_select(@bar), :prompt => "Please select a bar" | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment