Ruby %w empty value -


how add empty string select option %w(mr ms mrs miss)?

i can ['', 'mr', 'ms', 'mrs', 'miss'] use %w. thx!

use unshift prepended object front:

=> %w(mr ms mrs miss).unshift "" #> ["", "mr", "ms", "mrs", "miss"] 

pretty version without brackets.

ok update:

=> %w(#{} mr ms mrs miss) #> ["", "mr", "ms", "mrs", "miss"] 

explain:

  • %w - allow interpolation
  • %w - not allow interpolation
  • #{} - empty string

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -