Missing Partial Error in Rails 3

I get an error message:

Missing partial post/questions, application/questions with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in:* "/Users/..../<project name>/app/views" 

I tried to display all records in the database before index.html.erb .

My part of viewing post/index.html.erb :

  <!--html codes --> <%= render 'questions' %> 

Controller controller/post_controller.rb :

  def index @posts=Post.all end def questions end 

questions.html.erb

  <% =@posts.each do |post| %> <table> <tr> <td> <h2> <%=post.title%> </h2> </td> </tr> <tr> <td> <h3><%=post.body%></h3> </td> </tr> <tr> <td> This Post comes under:<h4><%=post.tag%></h4> </td> </tr> </table> 
+6
source share
1 answer

Partials file names must begin with an underscore. You should have _questions.html.erb saved in your mail folder. In addition, you do not need to determine the effect of โ€œquestionsโ€.

+17
source

Source: https://habr.com/ru/post/917581/


All Articles