This project is archived and is in readonly mode.
with_scope clobbers result attributes when :joins key is specified
-
duncanbeevers
Attached change to ActiveRecord::Base that gives precedence to last-specified select and provides table-name scoping to selects where joins are involved in the scoping, but not in the final set of find options.
-
duncanbeevers
- Title changed from named_scope should support joins to with_scope clobbers result attributes when :joins key is specified
Attached test showing with_scope injecting false attributes when :joins key is used in scope.
-
Pratik
- State changed from new to incomplete
Could you please upload a single patch ? I'm a little confused with 3 uploded patches. Also, it's good idea to use git-format-patch to create the diff file, so that you get the credit in commit message. http://rails.lighthouseapp.com/p... has a decent explanation.
I'll reopen the ticket after you upload a new patch.
Thanks !
-
Mark
I encountered this bug too.
I have combined the patches into one file and run the tests.
They expose the bug well so I can +1 this patch.
-
Jeremy Kemper
- Milestone set to 2.1.1
- Assigned user set to Jeremy Kemper
- State changed from incomplete to open
-
Repository
- State changed from open to resolved
(from [3558a50a1cb31dd207cc1932aaee5025a7dc7c1b]) Fix column collision with named_scope and :joins. [#46 state:resolved]
-
Repository
(from [0fd3e4cd2b2b1b31304a922dc65284d5363f78b6]) Fix column collision with named_scope and :joins. [#46 state:resolved]
-
duncanbeevers
Argh! I've helped make construct_finder_sql that little bit uglier!
-
David Stevenson
- Tag set to activerecord, joins, named_scope, patch
This seems like it's a problem with scoping and joins in general - couldn't this be caused by any scoped join?
