尝试设置静态页面,但收到以下错误:
缺少模板页面/ show_admin_panel,带有{:locale => [:en]的application / show_admin_panel,:formats => [:html], :handlers => [:erb,:builder,:raw,:ruby,:jbuilder,:coffee]}。 搜索:*" c:/ Users / Bill / Desktop / testapp / app / views" * " C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/devise-3.4.1/app/views"
我的路线:
get '/adminpanel' => 'pages#show_admin_panel'
页面控制器中的操作:
def show_admin_panel
@users = User.all
respond_with(@users)
end
视图:pages / adminpanel.html.erb:
<div class="row">
<div class="well">
<h1 class="color">Admin Panel</h1>
</div>
</div>
答案 0 :(得分:2)
请注意您的控制器操作和错误如何显示pages/show_admin_panel
(带下划线),但您的视图名为pages/adminpanel.html.erb
(开头没有下划线且没有“显示”部分)。