https://github.com/elia/obviews
Restores the obvious OOP method interface between Rails controllers and views
https://github.com/elia/obviews
Last synced: over 1 year ago
JSON representation
Restores the obvious OOP method interface between Rails controllers and views
- Host: GitHub
- URL: https://github.com/elia/obviews
- Owner: elia
- License: mit
- Created: 2012-05-31T20:55:54.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2013-09-25T22:52:36.000Z (almost 13 years ago)
- Last Synced: 2024-04-25T13:21:31.035Z (about 2 years ago)
- Language: Ruby
- Homepage: http://elia.github.com/obviews
- Size: 508 KB
- Stars: 12
- Watchers: 3
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# Obviews
## Example
In the controller
```ruby
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:
```haml
-# 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.