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

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -