Blog (views)

@fredwu 12 years ago | 1 min read | no comments
Ever wondered how you could utilise the render method outside the context of Rails controllers and views? If you wonder why anyone would do that. Well, imagine you are building an awesome form builder, you need to output and/or store rendered partials in the buffer. How do you do that? For example, what if you want to do this in your view? <%=raw Awesome::FormBuilder.new(some_options).html %> You could do something like this: module Awesome class FormBuilder < AbstractController...
@fredwu 14 years ago | 1 min read | no comments
Using Inherited Resources is an excellent way to reduce the amount of repetition in your controllers. But what about views? A lot of times resources share the same views, so why not DRY ‘em up using Inherited Resources Views! Go check out the code! :-)