Concatenating to an array constant for options_for_select


#1

Hello,

I have the following code:

<%= select_tag :role, options_for_select(Project::COMPANY_ROLES.concat
([‘Other…’]), @relationship.role), :class => ‘selectInput
hasOtherValue’ %>

For some reason it concatenates “Other…” to COMPANY_ROLES but saves
this past the view that was loaded.

1st Run = 1 option of “Other…”
2nd Run = 2 options of “Other…”
3rd Run = 3 options of “Other…”

I simply want it to concatenate during run-time and not save state.

Any ideas?

Thanks!


#2

This does the trick:

<%= select_tag :role, options_for_select(Project::COMPANY_ROLES +
[‘Other…’], @relationship.role), :class => ‘selectInput
hasOtherValue’ %>