Restores the obvious OOP method interface between Rails controllers and views
Ruby JavaScript CSS
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
Gemfile
Gemfile.lock
MIT-LICENSE
README.md
Rakefile
obviews.gemspec

README.md

Obviews

Example

In the controller

class PostsController < ApplicationController
  expose :blog, :posts
  
  def index
  end
  
  def show
    expose post: posts.first
  end
  
  private
  
  def blog
    @blog ||= Blog.first
  end
  
  def posts
    blog.posts
  end
end

In the views:

-# views/posts/index.html.haml
%h1= blog.title
= render posts

-# views/posts/show.html.haml
%h1= blog.title
= render post

-# views/posts/_post.html.haml
.post
  %h2= post.title
  %p= post.body

This project rocks and uses MIT-LICENSE.