This project is archived and is in readonly mode.

#6220 ✓invalid
eagle.anton (at gmail)

scope firings up on association

Reported by eagle.anton (at gmail) | December 24th, 2010 @ 02:27 PM

For example:

class Post < ActiveRecord
  belongs_to :user

  scope :published, where(:published => true)

  def self.some_action
    u = User.find(x)
    u.posts
  end

end

Post.published.some_action  # => SELECT "posts".* FROM "posts" WHERE "published" = "t" AND ("user_id" = "x");

Why there are we have scope for user association ? It should be isolated, isn't it?

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages