突然,我的管理页面将无法加载Padrino(未找到模板引擎)

时间:2011-08-01 16:19:48

标签: ruby sinatra padrino

之前我的应用中的管理页面从未遇到过问题,但重新启动机器后我收到此错误:

RuntimeError at /admin/sessions/new
Template engine not found: /sessions/new

使用这个缩写的回溯:

/Users/jeremysmith/code/robusto_server/admin/controllers/sessions.rb in block (2 levels) in <top (required)>
    render "/sessions/new", nil, :layout => false
/Users/jeremysmith/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb in service
      si.service(req, res)

app.rb中的所有内容与以前的内容相同:

set :login_page, "/admin/sessions/new"

  enable  :sessions
  disable :store_location

  access_control.roles_for :any do |role|
    role.protect "/"
    role.allow "/sessions"
  end

  access_control.roles_for :admin do |role|
    role.project_module :stat_definitions, "/stat_definitions"
    role.project_module :accounts, "/accounts"
  end

2 个答案:

答案 0 :(得分:1)

您需要添加app.rb

register Padrino::Rendering

答案 1 :(得分:0)

我使用模块化的Sinatra模式应用程序遇到了同样的问题,并且我的模板引擎很小。我无法渲染模板或部分。以下是我修复它的方法:

# Gemfile
gem 'padrino-core'
gem 'padrino-helpers'

# app.rb
require 'padrino-core/application/rendering'
require 'padrino-helpers'

class App < Sinatra::Base
  register Padrino::Rendering
  register Padrino::Helpers
end

http://www.padrinorb.com/guides/standalone-usage-in-sinatra

的更多信息