has_array_of icon indicating copy to clipboard operation
has_array_of copied to clipboard

Relation cannot use scopes right now

Open kritik opened this issue 7 years ago • 0 comments

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?

kritik avatar Jul 03 '18 10:07 kritik