1
사용자 모델 및 주소, SocialProfile 모델이 있습니다. 활성 관리자의 사용자 자원의 필터 섹션에 "zip", "address_line_1"과 같은 주소 모델의 필드를 표시하고 싶습니다.Active Admin은 필터의 관련 모델 필드를 사용합니다.
주소 모델은 SocialProfile 모델의 필드를 User의 동일한 리소스에 표시하려고합니다. belongs_to 모델의 활성 관리자에서 드롭 다운과 텍스트 검색의 필드를 모두 표시하려면 어떻게해야합니까? 응용 프로그램에서 사용자 리소스에 대한
class User < ActiveRecord::Base
has_many :addresses
has_many :social_profiles
end
class Address < ActiveRecord::Base
belongs_to :user
end
class SocialProfile < ActiveRecord::Base
belongs_to :user
end
필터/관리/user.rb
filter :mobile
filter :full_name
filter :zip #to use the address model's "zip" field
filter :source #use social_profile model's "social" field
대단원 !! 나를 위해 일했다! 'filter : addresses_zip, as : : string filter : social_profiles_mobile, as : : string' – Rishabh
Document 모델을 가지고 있고 User에 속한 것처럼 작동하고 있습니다. Document에 속한 IdentityDocument 모델 Document AA Resource 과 같은 필터를 추가 할 수 있습니다 ** 문서 belongs_to User ** 'filter : user_mobile, as : : string' ** 문서 has_many IdentityDocument, 여기서 type은 IdentityDocument의 속성입니다 ** 'filter : identity_documents_type, as : string ' – Rishabh