Created
January 7, 2017 00:38
-
-
Save iqbalhasnan/6f690599b5a194024f30338377f9e836 to your computer and use it in GitHub Desktop.
ActiveAdmin Group Select With Formstatic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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