Concatenating to an array constant for options_for_select

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!

This does the trick:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs