Note that there are some explanatory texts on larger screens.

plurals
  1. PONo route matches {:controller=>"posts", :action=>"show"}
    text
    copied!<p>I'm getting a routing error when I browse to my index page. I setup some straightforward stuff, model has <code>:title (string)</code> and <code>:content(text)</code>.</p> <p><strong>index.html.erb</strong></p> <pre><code>&lt;h1&gt;Listing all notes&lt;/h1&gt; &lt;% @posts.each do |post| %&gt; &lt;h2&gt;&lt;%= link_to post.title, post %&gt;&lt;/h2&gt; &lt;p&gt;&lt;%= post.content %&gt;&lt;/p&gt; &lt;hr/&gt; &lt;% end %&gt; &lt;small&gt;&lt;%= link_to "Add New Note", new_post_path %&gt;&lt;/small&gt; &lt;small&gt;&lt;%= link_to "Edit", edit_post_path(@post) %&gt;&lt;/small&gt; </code></pre> <p><strong>post_controller.rb</strong></p> <pre><code>class PostsController &lt; ApplicationController def index @posts = Post.all end def show @post = Post.find(params[:id]) end def new @post.new end def create @post = Post.new(params[:post]) if @post.save redirect_to posts_path, :notice =&gt; "Your Note was Saved!" else render "new" end end def edit @post = Post.find(params[:id]) end def update @post = Post.find(params[:id]) if @post.update_attributes(params[:post]) redirect_to posts_path else render "edit" end end </code></pre> <p>When I browse to the app on <code>:3000/posts</code>, I receive the error:</p> <blockquote> <p>No route matches {:controller=>"posts", :action=>"show"}</p> </blockquote> <p>My routes.rb looks like usual.</p> <p><strong>routes.rb</strong></p> <pre><code>NotePad::Application.routes.draw do resources :posts </code></pre> <p>Any help would be very useful.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload