Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dont decorate nil class #867

Open
bekicot opened this issue Dec 10, 2019 · 0 comments
Open

dont decorate nil class #867

bekicot opened this issue Dec 10, 2019 · 0 comments

Comments

@bekicot
Copy link

bekicot commented Dec 10, 2019

I create a custom load strategy

module Draper
  module QueryMethods
    module LoadStrategy
      class ActiveRecordWithKlass
        def allowed?(method)
          @allowed ||=
            ::ActiveRecord::Relation::VALUE_METHODS +
            [:klass, :reflect_on_association]
          @allowed.include? method
        end
      end
    end
  end
end

It tries to decorate nil class in lib/draper/query_methods.rb:7
because

`scope`.reflect_on_association

is returning nil

It should return the value as is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant