我有...
/config/routes.rb:
resources :documents do
member do
get :print
end
end
/config/authorization_rules.rb:
role :admin do
has_permission_on [:documents], :to => [:print]
end
应用程序/控制器/documents_controller.rb:
def print
render :layout => "print"
end
应用程序/视图/布局/print.html.haml:
!!!
%html
%body
= yield
我想从几个控制器中定义的打印操作访问这个打印布局文件。
为什么,当我以管理员身份登录并转到 时http://localhost:3000/documents/1/print
,会出现此错误?
Missing template documents/print, application/print with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee, :haml]}. Searched in:
* "/Users/steven/Dropbox/testivate/app/views"
* "/Users/steven/.rvm/gems/ruby-1.9.2-p320/gems/declarative_authorization-0.5.6/app/views"
将print.html.haml
文件移动到错误/app/views/application/
或/app/views/documents/
更改错误,但不会摆脱它。