ruby on rails - how to add possibilities in a select using f.input :object -



ruby on rails - how to add possibilities in a select using f.input :object -

i have form , want user select 1 of object.

activeadmin.register promo form |f| f.inputs f.input :user end f.actions end end

ok, works, want add together possibility "all" in select this, tried different things

f.input :user + "all" f.input :user, as: :select, collection: [:user, "all"]

but of course, doesn't work

you need collection of objects in :user inject 'all' in it.

@user_names = user.pluck(:name) #or whatever want have in select f.input(:user, as: :select, collection: @user_names + ['all'])

ruby-on-rails select input collections

Comments

Popular posts from this blog

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -