This project is archived and is in readonly mode.

#2931 ✓resolved
rubymood

find with :include ignores default_scope

Reported by rubymood | July 21st, 2009 @ 10:03 AM | in 3.x


class Game < AR::B
has_many :articles end
class Article < AR::B
belongs_to :game default_scope :order => 'created_at DESC' end

Calling Game.first(:include => :articles) generate this SQL


SELECT * FROM
games LIMIT 1
SELECT articles.* FROM articles WHERE (articles.game_id = 1)

When it should be

SELECT * FROM
games LIMIT 1
SELECT articles.* FROM articles WHERE (articles.game_id = 1) ORDER BY created_at DESC

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>

Attachments

Referenced by

Pages