small medium large xlarge

Generic-user-small
17 Aug 2010, 03:00
Darren Carter (3 posts)

Just curious, but would it be possible to touch on polymorphic associations. I believe these are very important in real world apps, and I know I and many others would benefit.

Sincerely, Darren

Generic-user-small
26 Aug 2010, 17:33
Darren Carter (3 posts)

Would anyone be willing to comment on this?

Thanks, Darren

Generic-user-small
26 Aug 2010, 20:39
Bharat Ruparel (148 posts)

I agree. +1 for Polymorphic assocications. Bharat

Samr_small_pragsmall
27 Aug 2010, 00:06
Sam Ruby (634 posts)

My first pass was that polymorphic associations didn’t make the cut – they are covered well by the guides and don’t appear to be essential as in being a technique that pretty much ever application will need.

Furthermore, searches on “Rails Polymorphic Associations” turns up plenty of tutorials (some quite dated), but not much evidence of real use.

On the other hand, it was included in edition 3 (and therefore I have the text), and asking around has identified enthusiastic users.

So: I’m listening… I’d like this to go into the Active Record chapter (obviously) and keep the page count for that chapter manageable, but at this point that chapter is not the largest chapter, so there is room.

Generic-user-small
06 Sep 2010, 04:55
Darren Carter (3 posts)

I would definitely like to see it included in there. I haven’t seen a good explanation of how to implement it, not that it doesn’t exist, but no book I’ve seen has really given it much coverage.

Thanks for the post! Darren

Generic-user-small
06 Sep 2010, 08:40
rubytech (3 posts)

Inclusion would be beneficial for developers.

28071pw75_pragsmall
08 Jan 2011, 04:36
John-Mason P. Shackelford (1 post)

I am leading a team building their very first Rails app and only two weeks into a four month project Polymorphic Associations comes up. +1 for coverage.

Other AR topics I specifically turned to the book expecting to find with a text search of the PDF but didn’t find: has_many :through, STI, and eager loading with :include. I have bought all four editions of the book each as paper and PDF. I have never fully read through the tutorial section but I have read the AR chapters over and over and over. The first thing one does in a new application is model the data and most apps I have worked on use all of these techniques at one point or another.

I don’t think I was aware of the AR guide published on the rails site until I read this forum. A note in the chapter about the AR guide- and how you can generate them yourself using Rake- would be a handy sidebar. The guide is very good with plenty of detail, but I think high level coverage of the major AR associations topics- the tools in the data modeling toolbox- mentioned with a few bits of advice would be very helpful. Without coverage of these tools in the book, I’d have to send my team directly to the guide which has more technical detail than one new to rails can easily absorb and relatively little in the way of pithy practical advice as to when to use them, how not to abuse them, and what the gotchas are.

Thanks for listening. A faithful reader.

Comic-560x560_pragsmall
28 Jan 2011, 19:19
Conrad Taylor (10 posts)

I agree that Polymorphic Associations should be an included topic. Furthermore, I have been faced with a scenario where a model is both polymorphic and the base class for STI. Thus, it may possibly be a good idea to provide an smallish example on how to construct your models, controllers, and view templates. From my google searches, I have been getting contradicting information on how to successfully get this working.

Generic-user-small
18 Feb 2011, 23:04
Adam Halstead (1 post)

My vote is for inclusion. In 3rd edition, I found the ‘Active Record Part II’ chapter the most useful chapter, and was the reason I suggested purchasing the book to my Rails co-workers. I think it is vital to describe how you are able to map a relational model into an object-oriented one, and discuss inheritance. I see in the current 4th edition that inheritance is not even in the index!

Generic-user-small
13 Mar 2011, 22:41
Doug Puchalski (4 posts)

I can’t see how something so important could be completely omitted from what can otherwise be a go-to reference for Rails. Everything should at least be mentioned, with some brief context and maybe a referral to external docs as necessary. I had to look it up and was very surprised I had to dig into the 3rd edition to do so.

M1_pragsmall
16 Mar 2011, 22:29
AckelsRan (1 post)

Yes you are right good post

You must be logged in to comment