Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails ActionView::Template::Error(缺少带有{:locale=>;[:en],:formats=>;[:html],:variants=>;[]的部分视图/作业/_索引,_Ruby On Rails_Haml - Fatal编程技术网

Ruby on rails ActionView::Template::Error(缺少带有{:locale=>;[:en],:formats=>;[:html],:variants=>;[]的部分视图/作业/_索引,

Ruby on rails ActionView::Template::Error(缺少带有{:locale=>;[:en],:formats=>;[:html],:variants=>;[]的部分视图/作业/_索引,,ruby-on-rails,haml,Ruby On Rails,Haml,我是ruby新手,这个错误不断出现,我不知道它的意思 代码如下: <% if current_user %> <%= link_to 'Sign Out' , destroy_user_session_path , method: :delete %> <%= render partial: "views/jobs/index" %> <% else %> <%= link_to 'Sign Up' , new_use

我是ruby新手,这个错误不断出现,我不知道它的意思

代码如下:

<% if current_user %>
 <%= link_to 'Sign Out' , destroy_user_session_path , method: :delete %>
 <%= render partial: "views/jobs/index" %>
<% else %>
<%= link_to 'Sign Up' , new_user_registration_path %>
<%= link_to 'Sign In' , new_user_session_path %>
<% end %>

我的问题是渲染。我试图从html.erb文件渲染html.haml文件。这可能吗?
如果是,那么这就是我得到的:

 ActionView::Template::Error (Missing partial views/jobs/_index with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :jbuilder, :haml]}. Searched in:
  * "C:/Users/farah/Desktop/rubyApp/jobapp/app/views"
  * "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/devise-4.7.3/app/views"
  * "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/actiontext-6.0.3.4/app/views"
  * "C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/actionmailbox-6.0.3.4/app/views"
):
    1: <% if current_user %>
    2:  <%= link_to 'Sign Out' , destroy_user_session_path , method: :delete %>
    3:  <%= render partial: "views/jobs/index" %>
    4: <% else %>
    5: <%= link_to 'Sign Up' , new_user_registration_path %>
    6: <%= link_to 'Sign In' , new_user_session_path %>
ActionView::Template::Error(缺少带有{:locale=>[:en],:formats=>[:html],:variants=>[],:handlers=>[:raw,:erb,:html,:builder,:ruby,:jbuilder,:haml]的部分视图/作业/_索引)。在以下位置搜索:
*“C:/Users/farah/Desktop/rubyApp/jobapp/app/views”
*“C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/designe-4.7.3/app/views”
*“C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/actiontext-6.0.3.4/app/views”
*“C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/actionmailbox-6.0.3.4/app/views”
):
1: 
2:  
三:
4: 
5: 
6: 
如您所见,这已经包括“视图”

您的render语句应该是

<%= render partial: "jobs/index" %>

处理程序包括
:haml
,因此它可以工作。

事实上,即使在更改呈现语句时:``
我仍然会遇到相同的错误,您试图呈现的视图在哪里?是
应用程序/视图/作业/\u索引.haml
?还是其他什么?是的,是的
app/views/jobs/\u index.haml
实际上(\u)已丢失。放置后,我可以访问该视图。但由于某些原因,我的作业中的每个都显示为
ActionView::Template::Error(对于nil:NilClass,未定义“each”方法):1:#jobs 2:-@jobs.each do | job | 3::job 4:%h2=link|u to job.title,job 5:%p=job.company
update:
仍然获得,
缺少部分作业/(带有{:locale=>[:en],:format=>[:html],:variants=>[],:handlers=>[:handlers=>[:raw、:erb、:erb、:html、:builder、:ruby、:jbuilder、:haml]}。搜索:*“C:/Users/farah/Desktop/rubyApp/jobapp/app/views”*“C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/designe-4.7.3/app/views”*“C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/actiontext-6.0.3.4/app/views”*“C:/Ruby27-x64/lib/ruby/gems/actionmailbox/2.7.0.3.4/app/views”
Searched in:
  * "C:/Users/farah/Desktop/rubyApp/jobapp/app/views"
<%= render partial: "jobs/index" %>
:handlers=>[:raw, :erb, :html, :builder, :ruby, :jbuilder, :haml]