ruby on rails - Adding filter for has_many relationship in rails_admin -


i'm using rails_admin reporting tool , leveraging export csv feature pull out specific data. works fine, need filter results based on data being between 2 dates, dates on on model linked through has_many relationship.

here example

class patient < activerecord::base   has_many :appointments end  class appointment < activerecord::base   belongs_to :patient   # has field: 'date' end 

i can load patients in railsadmin , in list view show appointments, how can add filter show patients have appointment between date x , y? possible @ all?

is there anyway use named scope , pass in parameters? or virtual model rails_admin load? sql pretty simple this, i'm not sure how pass in actual date parameters?

i curious how solve this.

one option add appointments filter dropdown not allow choose dates.

rails_admin   include_all_fields   field :appointments     filterable true   end   list     filters [:appointments] # make show default   end end 

another choice create custom action , create page @ app/views/rails_admin/mail/filter.html.haml can build regular search form


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -