apply_scopes and paginate lose origin & origin_attribute
Reported by Bryan Larsen | January 13th, 2012 @ 06:29 PM
Regression from Hobo 1.0 to 1.3:
If you call apply_scopes
or paginate
on a Relation, you lose the origin & origin_attribute for the
relation.
Comments and changes to this ticket
-
Bryan Larsen January 13th, 2012 @ 06:36 PM
I've tracked it down partially, but have to break, so here's what I've got so far: (This is notes to myself, but up for public view in case somebody wants to comment).
apply_scopes gets called through a method_missing in Relation that does this:
scoping { @klass.send(method, *args, &block) }
and apply_scopes calls scoped to get the relation which should have the origin but doesn't because of the above
perhaps we should do a
alias_method_chain
on ActiveRecord::Relation#scoped which tries to pop origin off the scoped_method stack that scoping creaes. -
Bryan Larsen January 13th, 2012 @ 11:06 PM
- Assigned user set to Domizio Demichelis
This fixes my immediate problem, but I haven't tested it outside of that.
https://github.com/bryanlarsen/hobo/commit/0c2a7cfc48f25a23b6c58873...
Note that my patch includes a monkey path to ActiveRecord::Relation and nukes one for will_paginate.
Domizio, do you remember why you added that monkey patch to will_paginate and see if my patch is a sufficient replacement for yours?
-
Matt Jones January 16th, 2012 @ 04:37 AM
It's a little blurry, but I seem to recall the patching to will_paginate was to fix things on
index_for_xxx
pages with a paginated collection. Not sure if this is still an issue. -
Bryan Larsen January 16th, 2012 @ 04:04 PM
(from [5a6ca514181e9e3022fed465e5e80cac485d3823]) [#995] ensure that origin & origin_attribute do not get lost during a relation merge
https://github.com/tablatom/hobo/commit/5a6ca514181e9e3022fed465e5e... -
Bryan Larsen January 16th, 2012 @ 04:04 PM
(from [80236822dd14bb04f41ef818c57d41f53ca7b633]) [#989] [#995] count tag broken on index_for_owner pages https://github.com/tablatom/hobo/commit/80236822dd14bb04f41ef818c57...
-
Bryan Larsen January 16th, 2012 @ 04:22 PM
hmmm, index_for seems to work without either patch. I notice that the patch has been around for a long time in one form or another for quite some time. Maybe it's just not necessary anymore?
-
Bryan Larsen January 28th, 2012 @ 09:39 PM
(from [0c2a7cfc48f25a23b6c58873fca678f548fb34c9]) [#995] ensure that origin & origin_attribute do not get lost during a relation merge
https://github.com/tablatom/hobo/commit/0c2a7cfc48f25a23b6c58873fca... -
Bryan Larsen January 28th, 2012 @ 09:39 PM
(from [e4a1bee1f8130a2520799d34ccb202b490de0e7e]) [#989] [#995] count tag broken on index_for_owner pages https://github.com/tablatom/hobo/commit/e4a1bee1f8130a2520799d34ccb...
-
Bryan Larsen February 2nd, 2012 @ 06:34 PM
(from [e44cf55f4e8af744a0e76e185081f70d21190412]) [#995] ensure that origin & origin_attribute do not get lost during a relation merge
https://github.com/tablatom/hobo/commit/e44cf55f4e8af744a0e76e18508... -
Bryan Larsen February 2nd, 2012 @ 06:34 PM
(from [ff95cac41deab19124661f23f7e25b22913e49a7]) [#989] [#995] count tag broken on index_for_owner pages https://github.com/tablatom/hobo/commit/ff95cac41deab19124661f23f7e...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
People watching this ticket
Tags
Referenced by
- 989 this_parent, this_field set incorrectly on new_for_owner page (from [80236822dd14bb04f41ef818c57d41f53ca7b633]) [#989]...
- 989 this_parent, this_field set incorrectly on new_for_owner page (from [e4a1bee1f8130a2520799d34ccb202b490de0e7e]) [#989] ...
- 989 this_parent, this_field set incorrectly on new_for_owner page (from [ff95cac41deab19124661f23f7e25b22913e49a7]) [#989]...