Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between :include_blank and :prompt in the Rails select helper?

In the Rails docs, the first two listed options for the select helper are :include_blank and :prompt. I've just realized that I'm using both in my code, but they seem to be interchangeable. Can anyone explain the difference? It's not clear to me from reading the docs.

like image 317
shanebonham Avatar asked Jul 02 '12 23:07

shanebonham


1 Answers

Main difference is:

include_blank: true

will render a blank option but

prompt: true

will execute

I18n.translate('helpers.select.prompt', :default => 'Please select')
like image 64
Alper Karapınar Avatar answered Oct 19 '22 10:10

Alper Karapınar