Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iqbalhasnan/6f690599b5a194024f30338377f9e836 to your computer and use it in GitHub Desktop.
Save iqbalhasnan/6f690599b5a194024f30338377f9e836 to your computer and use it in GitHub Desktop.
ActiveAdmin Group Select With Formstatic
class Category < ApplicationRecord
has_many :types
end
class Type < ApplicationRecord
belongs_to :category
end
# Admin DSL. you need to pass the the selected type_id by passing the form object value.
f.input :category
f.input :type, as: :select, collection: option_groups_from_collection_for_select(Category.all, :types, :name, :id, :name, f.object.type_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment