Sha256: a7af82e613928e2b1d1cc962d99b2cded07fd5bed6a13d7c0b408b80790a1c60
Contents?: true
Size: 965 Bytes
Versions: 6
Compression:
Stored size: 965 Bytes
Contents
# encoding: utf-8 module Rango module ExplicitRendering def render(template, locals = Hash.new) super(template, self.locals.merge!(locals)) end # class Posts < Rango::Controller # def context # Object.new # end # # def show # # you can't use @explicit # post = Post.get(params[:id]) # render "post.html", post: post # end # end # # Context for rendering templates # This context will be extended by same crucial methods from template mixin # We are in context of current controller by default def context Object.new.extend(Rango::Helpers) end # def show # locals[:post] = Post.get(params[:id]) # render "show.html", locals # end def locals @locals ||= {request: self.request} end end module ImplicitRendering def context self end def render(template) super template end end end
Version data entries
6 entries across 6 versions & 1 rubygems