As for now I have candidate for most annoying issue with Rails. It is related to Ruby itself. But first – have You seen this movie? This screencast compares developing simple webapp in few frameworks – J2EE, Rails, Django, Zope, TurboGears.
Judging from dates showing on screen shots it was made year ago (Feb 2006), and some issues raised against Rails have been resolved long time ago (like using migrations to create databases instead of using SQL directly). But one still is pending. Conflicts in methods names. Using associations is very handy, but often You can have clash with filed in association (thus such auto-generated method) and some Ruby keyword. I have ran on it just with filed in model type which collides with deprecated, but still alive Ruby objects type
method. Accessing this field through association results with strange error messages.
So don’t think You will succeed writing @profile.addresses[0].type
if You don’t mean calling for class
method for @profile.addresses[0]
.
Is there some viable solution? Maybe something similar to JavaScript’s prototype? Calling @profile.addresses[0].type
should return field type
from first Address
in profile
through has_many
association, and testing what type of object it is would be @profile.addresses[0].prototype.type
?