I'm trying to set a specific order to an association, but I keep getting
the default scope order definition.
What am I missing?
class Pattern < ActiveRecord::Base
default_scope { order('sort, title') }
has_and_belongs_to_many :children,
:class_name => 'Pattern',
:join_table => 'patterns_patterns',
:association_foreign_key => 'child_id',
:foreign_key => 'parent_id',
:order => 'patterns_patterns.updated_at'
end
SELECT "patterns".* FROM "patterns" INNER JOIN
"patterns_patterns" ON
"patterns"."id" =
"patterns_patterns"."child_id" WHERE
"patterns_patterns"."parent_id" = ? ORDER BY sort, title
[["parent_id",
1]]
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/23f48525-91f1-49e8-8eb9-10fa292be80e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.