activeadmin-mongoid icon indicating copy to clipboard operation
activeadmin-mongoid copied to clipboard

Select filter is not working

Open kot-begemot opened this issue 5 years ago • 3 comments

Spec:

activeadmin (1.4.3)
activeadmin-mongoid (0.8.0)
  remote: https://github.com/activeadmin/activeadmin-mongoid.git
  revision: ff45b6379cec574e687548b607cad225fd2cf403
  branch: master
 ransack-mongoid (0.1.0)
  remote: https://github.com/activerecord-hackery/ransack-mongoid.git
  revision: bd1935293d2f285fa7cf33d2c5c90d981bf67338

Error undefined method +' for nil:NilClass`

Reported line activeadmin (1.4.3) lib/active_admin/inputs/filters/select_input.rb

Active admin setup:

ActiveAdmin.register SellOrder do
  actions :all, :except => [:new, :edit, :destroy]

  index do
    selectable_column
    column :name
    column :user
    column "Domains" do |sell_order|
      sell_order.domains.count
    end
    column :state
    actions
  end

  filter :name
  filter :state, as: :select, collection: SellOrder.state_machine.states.map(&:name)
  filter :created_at

  show do
     ...
  end
end

Investigation activeadmin-mongoid substitutes method searchable_method_name with broken equivalent, while original method itself works like a charm

kot-begemot avatar Apr 02 '19 10:04 kot-begemot

Would you be willing to submit a PR?

grzegorz-jakubiak avatar Apr 08 '19 17:04 grzegorz-jakubiak

Sure, I'll do

kot-begemot avatar Apr 16 '19 08:04 kot-begemot

@kot-begemot please try this https://github.com/activeadmin/activeadmin-mongoid/pull/143

grzegorz-jakubiak avatar Sep 05 '19 12:09 grzegorz-jakubiak