Google Groups

Object-Oriented Controllers

Avdi Grimm Apr 30, 2012 6:28 PM
Posted in group: Objects on Rails
Several people have asked me what what I think truly object-oriented
controllers would look like. I haven't had time to write down my
ideas, but I feel like now I don't have to because Jon Leighton has
nailed it:

I've seen a few whacks at this problem involving things like DSLs for
setting up different contexts for different actions, but they rubbed
me the wrong way. If two different actions require two different sets
of helper methods, they should be two different objects.

Check out the README, it makes a great case for representing separate
actions as separate objects, possibly sharing common inheritance or

I'm sure some people will be repelled by the verbosity of it, but I
suspect that it wouldn't be hard to apply some minimal DSL sugar which
preserved the semantics while cutting down on the need to type "class"
over and over.

Anyway, I'm excited to see this.

Avdi Grimm

I only check email twice a day. to reach me sooner, go to