As you've likely seen in your feed reader about 50 times already, Rails is turning 2.0. The Preview Release has just been announced, which means that 2.0 final is just a few release candidates away. So much has changed over the last year or so that a lot of the older material on this blog is out of date and needs updating for the reality of 2.0. Seems like now is a good time to get going on the rewriting. I'll be digging in and bringing stuff up to date over the next few weeks (months? there are quite a few articles after all).
Here's the list of articles I'm going to be taking a look at. I'm not certain that all need updates, but I think most of them do. If you have a request for something in particular for me to work on sooner, just leave a comment and I'll take that into account. Of course, I'll be updating the Many-to-many Dance-off first!
- New association goodness in Rails 1.1
- New association goodness in Rails 1.1, part 2
- The other ways :through
- The other side of polymorphic :through associations
- Why aren't join models proxy collections?
- Many-to-many Dance-off!
- Self-referential has_many :through associations
- has_many :through gets :uniq
- When associations aren't enough
- When associations aren't enough, part 2
- Working with the relationship model
- CRUDdy searches
- How dynamic finders work
- New on edge: Magic join model creation
- Finding unassociated objects
- Basic Rails association cardinality
- Using faux accessors to initialize values
Josh, thanks for doing this! I have your site and api.rubyonrails.com open any time I am hacking away at anything mildly complex in rails.
Yes, thank you! This is a great resource. It's great to read that you'll be helping us find our way :through Rails 2.0 too.
Very helpful! Thank you!
Neat! The world has enough outdated blog posts.
I think this one needs an update :
Why aren't join models proxy collections?
with -> pat has_many :skills, :through=>:certifications
pat.skills.size # => 5 winxp = Skill.find(13) pat.skills << winxp pat.skills.size # => 6 pat.save pat.skills(true).size # => 5
It works since 1.2 if I'm not wrong.
Hope to see many_more :posts
PS : question : is winxp skill bad luck ?
Hi Josh and everybody else, thanks for a fantastiv resource! I'm pretty new to rails and ruby, and this blog has helped me a lot already!
So, I've been reading the "New on edge: Magic join model creation" post, and tried to implement the solution on rails edge (2.0 pre-release), but it seems that the ActiveRecord::Base.with_scope method has changed from public to protected scope, which makes the solution throw exeptions at You :-|
Would be good to have that post updated...
btw - any clue why the with_scope method changed status from public to protected?
Cheers
Eek. I'm getting bitten by with_scope, as used in http://blog.hasmanythrough.com/2006/8/19/magic-join-model-creation, now being protected in Rails 2.O.
Have you dealt with this? If so what solution have you found?
Cheers, Walter
Nevermind. After I stopped freaking out about having such a critical bug, I thought about what the code was actually doing, added a class method for Contribution that is basically a wrapper of the with_scope call, called that instead from within the '<<' definitions, and DRYed up my code a bit in the process.
Cheers, Walter
Walter: Nice. I may have to use that trick in my (eventual) re-write.
Since you asked... Could you see if "The other side of polymorphic :through associations" need an update?
Thanks!!!!
Walter, in the meantime, can you post that fix? I'm confused about the changing context of 'self' in "self.concat author" when sent do a wrapper method. Did you change this to explicitly be the Book class?