Skip to content

Instantly share code, notes, and snippets.

@marcus
Created October 17, 2008 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcus/17537 to your computer and use it in GitHub Desktop.
Save marcus/17537 to your computer and use it in GitHub Desktop.
def select_options_tag(name='',select_options={},options={})
#set selected from value
selected = ''
unless options[:value].blank?
selected = options[:value]
options.delete(:value)
end
select_tag(name,options_for_select(select_options,selected),options)
end
##
<%= select_options_tag :account, current_user.smtp_accounts.map{ |a| [a.name,a.name] } %>
## By 'grosser', found:
## http://apidock.com/rails/ActionView/Helpers/FormTagHelper/select_tag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment