title: Routing generated paths in Ruby on Rails
body: <p>I'm a beginner in ruby-on-rails and I spent my last hour trying to do the following thing:</p>
  
  <p>I have a ruby-on-rails application - the blog with posts and categories. 
  I want to have another URL for the posts (I would like to have <code>http://localhost:3000/news</code> instead of <code>http://localhost:3000/posts</code>) First I tried to replace the controller and classes from <code>Posts</code> to <code>News</code>, but I gave up(because of the annoyng singular-plural thing). Then in my I replaced <code>map.resources :posts</code> (case 1) to</p>
  
  <pre><code>  map.resources :news, :controller =&gt; "posts"     #case 2
  </code></pre>
  
  <p>or</p>
  
  <pre><code>  map.resources :posts, :as =&gt; 'news'             #case 3
  </code></pre>
  
  <p>in <code>routes.rb</code> as I saw on <a href="http://guides.rubyonrails.org/routing.html" rel="nofollow noreferrer">some websites</a>. It doesn't work either.</p>
  
  <p>How can I do this?</p>
  
  <hr>
  
  <p>EDIT: </p>
  
  <p>the output of <code>rake routes</code> is (only first lines):</p>
  
  <p>for case 1 and 3:</p>
  
  <pre><code>               posts GET    /posts                           {:action=&gt;"index", :controller=&gt;"posts"}
       formatted_posts GET    /posts.:format                   {:action=&gt;"index", :controller=&gt;"posts"}
                       POST   /posts                           {:action=&gt;"create", :controller=&gt;"posts"}
                       POST   /posts.:format                   {:action=&gt;"create", :controller=&gt;"posts"}
              new_post GET    /posts/new                       {:action=&gt;"new", :controller=&gt;"posts"}
    formatted_new_post GET    /posts/new.:format               {:action=&gt;"new", :controller=&gt;"posts"}
             edit_post GET    /posts/:id/edit                  {:action=&gt;"edit", :controller=&gt;"posts"}
   formatted_edit_post GET    /posts/:id/edit.:format          {:action=&gt;"edit", :controller=&gt;"posts"}
                  post GET    /posts/:id                       {:action=&gt;"show", :controller=&gt;"posts"}
        formatted_post GET    /posts/:id.:format               {:action=&gt;"show", :controller=&gt;"posts"}
                       PUT    /posts/:id                       {:action=&gt;"update", :controller=&gt;"posts"}
                       PUT    /posts/:id.:format               {:action=&gt;"update", :controller=&gt;"posts"}
                       DELETE /posts/:id                       {:action=&gt;"destroy", :controller=&gt;"posts"}
                       DELETE /posts/:id.:format               {:action=&gt;"destroy", :controller=&gt;"posts"}
  </code></pre>
  
  <p>the output for case 2:</p>
  
  <pre><code>           news_index GET    /news                            {:action=&gt;"index", :controller=&gt;"posts"}
   formatted_news_index GET    /news.:format                    {:action=&gt;"index", :controller=&gt;"posts"}
                        POST   /news                            {:action=&gt;"create", :controller=&gt;"posts"}
                        POST   /news.:format                    {:action=&gt;"create", :controller=&gt;"posts"}
               new_news GET    /news/new                        {:action=&gt;"new", :controller=&gt;"posts"}
     formatted_new_news GET    /news/new.:format                {:action=&gt;"new", :controller=&gt;"posts"}
              edit_news GET    /news/:id/edit                   {:action=&gt;"edit", :controller=&gt;"posts"}
    formatted_edit_news GET    /news/:id/edit.:format           {:action=&gt;"edit", :controller=&gt;"posts"}
                   news GET    /news/:id                        {:action=&gt;"show", :controller=&gt;"posts"}
         formatted_news GET    /news/:id.:format                {:action=&gt;"show", :controller=&gt;"posts"}
                        PUT    /news/:id                        {:action=&gt;"update", :controller=&gt;"posts"}
                        PUT    /news/:id.:format                {:action=&gt;"update", :controller=&gt;"posts"}
                        DELETE /news/:id                        {:action=&gt;"destroy", :controller=&gt;"posts"}
                        DELETE /news/:id.:format                {:action=&gt;"destroy", :controller=&gt;"posts"}
  </code></pre>
  
  <p>I have errors in case 2, because in my sourcecode I don't have <code>edit_news</code>, I have for example <code>&lt;%= link_to 'Edit', edit_post_path(post) %&gt;</code></p>