Last active
August 29, 2015 13:56
-
-
Save jkmcrg/9009297 to your computer and use it in GitHub Desktop.
collection select
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
# this: | |
%select{name: "recipe[recipe_season_id]"} | |
-for season in @recipe_seasons | |
%option{value: season.id, selected: season_option_select(season)}= season.name | |
# can be replaced with this: | |
= f.collection_select :season_id, @recipe_seasons, :id, :name | |
# Where `f` is the form object, `season_id` is the field of the object that you | |
# want to set,`@season` is the collection, `:id` is the method to call on | |
# your collection to set the value of the select, and `:name` is the method | |
# to call to set the option text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment