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

Relation cannot use scopes right now #4

Open
kritik opened this issue Jul 3, 2018 · 0 comments
Open

Relation cannot use scopes right now #4

kritik opened this issue Jul 3, 2018 · 0 comments

Comments

@kritik
Copy link

kritik commented Jul 3, 2018

Should I make pull request that if you have some_scope then it's not working. Example:

class Video < ActiveRecord::Base
  belongs_to_array_in_many :playlists # optional
  scope :archived, ->{where(archived: true)}
end

If I run Playlist.first.videos.archived, then I get an error. Fix for that will be:

module HasArrayOf
  class AssociatedArray::Relation
    attr_reader :relation

    def method_missing(m, *args, &block)
      relation.public_send(m, *args, &block)
    end
  end
end

Should I make pull request for this problem?

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