activeadmin / activeadmin-mongoid

ActiveAdmin hacks to support Mongoid
MIT License
192 stars 210 forks source link

Select filter is not working #138

Open kot-begemot opened 5 years ago

kot-begemot commented 5 years ago

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

grzegorz-jakubiak commented 5 years ago

Would you be willing to submit a PR?

kot-begemot commented 5 years ago

Sure, I'll do

grzegorz-jakubiak commented 5 years ago

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