# With\_scope & association proxies

**URL:** <https://www.ruby-forum.com/t/with-scope-association-proxies/123919>\
**Category:** Rails\
**Created:** [December 22, 2007, 1:03am UTC](https://www.ruby-forum.com/t/with-scope-association-proxies/123919 "2007-12-22T01:03:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fcheung](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/90db22/32.png) [@fcheung](https://www.ruby-forum.com/u/fcheung)\
**Post date:** [December 22, 2007, 1:03am UTC](https://www.ruby-forum.com/t/with-scope-association-proxies/123919/1 "2007-12-22T01:03:36Z")

</div>

I’ve been doing stuff like

class Book \< ActiveRecord::Base  
has\_many :contributions, :dependent =\> :destroy  
has\_many :contributors, :through =\> :contributions, :uniq =\> true  
has\_many :authors, :through =\> :contributions, :source  
=\> :author, :conditions =\> “contributions.role = ‘author’” do  
def \<\<(author)  
Contribution.with\_scope(:create =\> {:role =\> “author”})  
{ self.concat author }  
end  
end  
end

(which I stole from  
[has\_many :through - New on edge: Magic join model creation](http://blog.hasmanythrough.com/2006/8/19/magic-join-model-creation))

In 2.0 with\_scope is protected, to discourage abuse. Is this still a  
legitimate use of with\_scope or is there a better pattern to follow ?

Fred
