jhund / filterrific

Filterrific is a Rails Engine plugin that makes it easy to filter, search, and sort your ActiveRecord lists.
http://filterrific.clearcove.ca
MIT License
910 stars 124 forks source link

Incompatibility with Delayed Job? #155

Open vincentcordel opened 6 years ago

vincentcordel commented 6 years ago

rails (5.1.4) ruby (2.4.1) filterrific (5.0.1)

class Crm::User < ActiveRecord::Base

...

  filterrific(
    default_filter_params: { sorted_by: 'created_at_desc' },
    available_filters: [
      :sorted_by,
      :filter_by,
      :search_query
    ]
  )

  def send_invitation_email
    Delayed::Job.enqueue Crm::Users::SendInvitationJob.new(self.id, self.activation_token)
  end

...

end

I get "undefined method `filterrific' for #<Class:..." when trying to send a mail within a method of the same model.

If I remove filterrific, it works normally.

jhund commented 6 years ago

Are you sure that the Filterrific gem is loaded? Are you using Bundler, and did you add Filterrific to your Gemfile?

vincentcordel commented 6 years ago

My mistake : I had both will_paginate and kaminari loaded which created the error. Once I removed kaminari, everything was working properly.

edwardmp commented 6 years ago

@musixite please close the issue