Project

obviews

0.0
No commit activity in last 3 years
No release in over 3 years
Restores the obvious OOP method interface between Rails controllers and views
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 3.2.3
 Project Readme

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.