Blank Row in Select_Tag – Ruby on Rails

Hey everyone,

Just a quick post on how to include a blank row or prompt value when using a select_tag in rails:

1
2
3
4
5
6
 
#Prompt
<select_tag "Animals", animals_as_options, :prompt => "Please select an animal" />
 
#Blank option
<select_tag "Animals", animals_as_options, :include_blank => true />

Let me know if you have any issues.

Leave a Reply