Skip to content
This repository has been archived by the owner on Jul 11, 2020. It is now read-only.

Refinements on remote methods #4

Open
dmcinnes opened this issue Sep 26, 2014 · 1 comment
Open

Refinements on remote methods #4

dmcinnes opened this issue Sep 26, 2014 · 1 comment

Comments

@dmcinnes
Copy link
Collaborator

Should we allow refinements on remote methods like we do with associations.

Given a Post

class Post < ActiveRecord::Base
  has_many :comments
  def top_comments
     comments.order_by(:like_count)
  end
end

And its Comment:

class Comment < ActiveRecord::Base
   scope :edited, -> { where.not(updated_at: nil) }
end

Could we?

Post.first.top_comments.edited 
@dmcinnes
Copy link
Collaborator Author

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

No branches or pull requests

1 participant