Feb 16
Call For Experiences: Rails Edge Cases
I'm in the process of putting together a presentation for my local Rails User Group and thought I'd solicit some additional real world examples.
The topic is going to be: Edge Cases: When Rails Gets In Your Way. Now, 99.9% of the time, Rails is an absolute pleasure to work with, and takes productivity through the roof. But on some rare occasions I've pulled my hair out trying to get something done.
In the process of creating this presentation, I also plan to produce a lot of example source code, and hopefully some patches for Rails. So please, don't send me hate mail saying how great Rails is and that I'm a bad man for saying anything negative about it ;)
Here is a brief list of some of the topics I already plan on covering:
- Polymorphic associations make joins difficult
- has_many
:throughdoesn't work with polymorphic associations - Using partials with ActionMailer takes a bit of magic
- Using
Model#findwith:joinscan get the wrong attributes unless you also use @:select@ - Log files get huge (most people forget to have them externally rotated)
- Excessive use of modules (think view helpers) makes it harder to write OO code
- Monkey patching can actually prevent code from being loaded by the auto-dependency loader
- RJS Templates can be evil (and I'm not the only one who thinks so)
And some common solutions that shouldn't be so common:
- When you don't want inheritance to result in STI using a Mixin might be better than defining
abstract_class? - Incorrectly using
with_scopeinside controller around filters instead of association proxy methods - Adding to the errors object from outside a validation callback
Well, that should at least give you an idea what this presentation is all about. I'd really like to make it a good one, and something that I could release slides and source code for as well (maybe a screencast?) And that's where you come in.
Have you run into a brick wall with Rails? Is there something tricky in Rails that you want to advice other people to watch out for? Please post a comment, or write me an email. If I use your experience in the presentation I'll make sure your name goes on the credits.
module ActionMailer class Base def self.controller_path '' end end end