# Ruby Web Frameworks: Controller Objects vs Controller Methods

**URL:** <https://metaruby.com/t/ruby-web-frameworks-controller-objects-vs-controller-methods/357>\
**Category:** Ruby Chat\
**Created:** [September 22, 2015, 5:11am UTC](https://metaruby.com/t/ruby-web-frameworks-controller-objects-vs-controller-methods/357 "2015-09-22T05:11:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielpclark](https://metaruby.com/user_avatar/metaruby.com/danielpclark/32/823_2.png) [@danielpclark](https://metaruby.com/u/danielpclark)\
**Post date:** [September 22, 2015, 5:11am UTC](https://metaruby.com/t/ruby-web-frameworks-controller-objects-vs-controller-methods/357/1 "2015-09-22T05:11:46Z")

</div>

After writing my blog post [Introspection by Design in Ruby](http://6ftdan.com/allyourdev/2015/09/21/introspection-by-design-in-ruby/) I was trying to think of how I might implement it with Rails’ controller methods. The idea is simple; I want to have Rails call Ruby Objects rather than methods on a Controller Object. The purpose is for pure OOP design and working with the messaging pattern.

At first glance it looks like Rails is not designed to work this way and will be very difficult to implement. Then I started thinking, perhaps other Ruby web frameworks were designed with this in mind? So after looking into it I found one: Lotus!

I’d like to discuss this aspect of different web frameworks. Anyone know of other Ruby web frameworks that have Objects for controller/view paths rather than methods?

From what I can see it’s like this:

**Controller Object vs Method Per Framework**

- Rails - Methods
- Trailblazer - Methods (Objects with [Operations](https://github.com/apotonick/trailblazer#operation) uses the **process** method on the object) _(technically not a framework)_
- Ramaze - Methods
- Lotus - Objects (uses the **call** method on the object for the view display)
- Cuba - ??either??
- Volt - ??either??
- Sinatra - ??either??
- Cramp - Objects (uses the **start** method)

Please let me know of any corrections or additions to this list!

* * *

Examples:

**Lotus**

```
class Show
  include Lotus::Action    
  def call(params)
    @article = Article.find params[:id]
  end
end

```

**Rails**

```
class ArticleController < ApplicationController
  def show
    @article = Article.find params[:id]
  end
end
```
