ruby - Is there a usable rendering context in sinatra/padrino? -
i attempting use exhibit pattern in padrino application need access rendering context. is, need have object context
such calling along lines of context.render('accounts/index')
produce identical output when render 'accounts/index'
called inside controller (assuming variables set same , app/views/accounts/index.erb
template file).
i can't find within padrino public api, attempted dig deeper. existing render
method in controller wraps sinatra's render
method, private instance method. it's not not defined on class myapp
(i.e. padrino::application
subclass). myapp.new
results in instance of rack::session::cookie
rather of itself, , none of padrino methods can find return existing instance of app, suitable candidate context
object if called private render
method.
is that's inherently difficult bother given sinatra's , padrino's designs, or there i'm missing here?
i realise answer in objects on rails book if i'd kept reading. needed pass context explicitly within template: exhibit(object, self)
inside template causes template's rendering context passed second argument. of course.
i guess wasn't specific padrino after , looking complicated when answer simple.
Comments
Post a Comment