tags:

views:

181

answers:

2

I need to render a Sinatra erb template inside a class in my controller. I'm having issues calling this though. I've looked in the Sinatra rdocs and have come up with this:

Sinatra::Templates.erb :template_to_render

When I do this, I get the following error:

undefined method `erb' for Sinatra::Templates:Module

Is there a way to call this from another class?

A: 

why you don't require 'erb' and after use only erb


  ## You'll need to require erb in your app
  require 'erb'

  get '/' do
    erb :index
  end
shingara
Thanks, but that doesn't work for what I'm doing. Those instructions are rather old, and do not apply to the current versions of Sinatra. Ideally, I'd like to use Sinatra's built in erb.
Eugene
which version of sinatra ?
shingara
A: 

I figured this one out. I ended up rewriting the code and doing some variable passing through the partials.

Eugene