procore/sift

ActionController::RoutingError (undefined method `filter_on`)

Closed this issue · 1 comments

I added the filterable gem to my bundle for my API and immediately got this error.

Started GET "/v1/staff_members?filters=%5Bfirst_name%5D%3Dbrandon" for 127.0.0.1 at 2017-06-01 13:56:09 -0400

ActionController::RoutingError (undefined method `filter_on' for Api::V1::StaffMembersController:Class
Did you mean?  filter):

app/controllers/api/v1/staff_members_controller.rb:6:in `<class:StaffMembersController>'
app/controllers/api/v1/staff_members_controller.rb:3:in `<module:V1>'
app/controllers/api/v1/staff_members_controller.rb:2:in `<module:Api>'
app/controllers/api/v1/staff_members_controller.rb:1:in `<top (required)>'

Here is my controller

module Api
  module V1
    class StaffMembersController < ::ApplicationController
      include Filterable

      filter_on :first_name, type: :string
      filter_on :last_name, type: :string
      filter_on :username, type: :string
      filter_on :windows_username, type: :string

      def index
        render json: filtrate(StaffMember.all)
      end

      def show
        render json: StaffMember.find(params[:id])
      end
    end
  end
end

Apparently gem install filterable installs a completely different gem... :|