I am getting an error:
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 render all posts in the database to index.html.erb
.
My view part is 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
<%[email protected] 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>
Partials' file names must begin with an underscore. You should have _questions.html.erb saved in the post folder. Also, you don't need to define a 'questions' action.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With