Scoring Association in RailsAdmin

I am trying to combine a link so that users cannot see reminders that were already sent when editing the relationship. However, I want them to be seen in the show view, but not in edit mode.

I cannot get the scope for each field. I can cover the whole has_many call with proc, but that will not let me show the results on the "show" page as it extends. Here is my current code that does not seem to work based on the RailsAdmin wiki:

group :reminders do label 'Reminders' field :reminders do active true associated_collection_scope do Proc.new { |scope| scope = scope.where(sent: false) } end end end 
+4
source share
2 answers

Maybe try throwing your code above inside the edit do ; end block edit do ; end edit do ; end . So, it will become:

 edit do group :reminders do label 'Reminders' field :reminders do active true associated_collection_scope do Proc.new { |scope| scope = scope.where(sent: false) } end end end end 
+1
source
 associated_collection_cache_all true 

This should help

0
source

All Articles