ruby - Pass both the arguments and the template inside the ERB layout -
i'm trying create rails-like mvc framework on ruby. got troubles rendering template inside of layout , injecting tags css , js. want layout contain template (passed controller) , tags pointing css , js files, generated controller name (for example, if controller named 'links', js file located in app/assets/javascript/links.js)
far figured out how render erb file inside of erb (template inside of layout)
class inserts template inside of layout:
require "erb" class layoutrenderer def self.render(template, layout) templates = [template, layout] templates.inject(nil) | prev, temp | _render(temp) { prev } end end def self._render temp erb.new(temp).result( binding ) end end
so template renders layout yield. can't understand how can pass layout path assets files , template together. in rails framework render inside of erb layout gracefully, don't understand how :)
Comments
Post a Comment