Note that there are some explanatory texts on larger screens.

plurals
  1. POdots in URL routes with namespace rails 3.1
    text
    copied!<p>I have this in <strong>routes.rb</strong></p> <pre><code>root :to =&gt; "posts#index" devise_for :users, :controllers =&gt; { :omniauth_callbacks =&gt; "users/omniauth_callbacks" } resources :users, :only =&gt; :show resources :boards resources :posts do resources :comments end namespace :users do resources :posts do get :posts, :on =&gt; :member end resources :boards do get :boards, :on =&gt; :member end end </code></pre> <p>rake routes:</p> <pre><code> boards_users_board GET /users/boards/:id/boards(.:format) {:action=&gt;"boards", :controller=&gt;"users/boards"} users_boards GET /users/boards(.:format) {:action=&gt;"index", :controller=&gt;"users/boards"} POST /users/boards(.:format) {:action=&gt;"create", :controller=&gt;"users/boards"} new_users_board GET /users/boards/new(.:format) {:action=&gt;"new", :controller=&gt;"users/boards"} edit_users_board GET /users/boards/:id/edit(.:format) {:action=&gt;"edit", :controller=&gt;"users/boards"} users_board GET /users/boards/:id(.:format) {:action=&gt;"show", :controller=&gt;"users/boards"} </code></pre> <p>If I put this link with 2 parameters:</p> <pre><code>&lt;% @posts.each do |post| %&gt; &lt;%= link_to post.board.name, users_board_path(post.user, post.board) %&gt; &lt;% end %&gt; </code></pre> <p>I get the next url with a dot:</p> <p><a href="http://localhost:3000/users/boards/hyperrjas.board-2" rel="nofollow">http://localhost:3000/users/boards/hyperrjas.board-2</a></p> <ul> <li><strong>hyperrjas is the user_id that I have put with slug :username.</strong></li> <li>I use namespace because are nested resources and I have a panel for users.</li> </ul> <p><strong>My question is: How can I change the dot for slash / in my generated url?</strong> should look and work as follows:</p> <p><a href="http://localhost:3000/users/boards/hyperrjas/board-2" rel="nofollow">http://localhost:3000/users/boards/hyperrjas/board-2</a></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