Skip to content

Relation cannot use scopes right now #4

@kritik

Description

@kritik

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions