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
Post a Comment