I have just installed Devise and now I want to make better style for Devise. I have added in application.html.rb link to edit Devise user profile, but when I visit this page and then go back for example to index page I have no routes matches error.
HTML generates this link for home/index: http://localhost:3000/assets?controller=devise%2Fhome
but really need to be: http://localhost:3000/home/index
There goes something wrong after visiting Devise user pages.
My navigation:
<ul>
<li>
<h2>Izvēlne</h2>
<ul>
<li><a class="menu"><%= link_to "Jaunumi" ,:controller=>"home", :action => "index" %></a></li>
<li><a class="menu"><%= link_to "Par skolu" ,:controller=>"home", :action => "par_skolu" %></a></li>
<li><a class="menu"><%= link_to "Galerijas" ,:controller=>"home", :action => "galerijas" %></a></li>
<li><a class="menu"><%= link_to "Skolotāji" ,:controller=>"home", :action => "personals" %></a></li>
<li><a class="menu"><%= link_to "Kontaktinformācija" ,:controller=>"home", :action => "kontakti" %></a></li>
<li><a class="menu"><%= link_to "Personāla pieeja" ,:controller=>"home", :action => "pers_pieeja" %></a></li>
</ul>
</li>
<li>
<h2>Administrācija</h2>
<ul>
<li><%= link_to "Lietotāju rediģēšana", edit_user_registration_path %></li>
<li><%= link_to "Rakstu rediģēšana" ,:controller=>"posts", :action => "index" %></li>
<li><%= link_to "Galeriju rediģēšana" ,:controller=>"admin", :action => "galeriju_red" %></li>
</ul>
</li>
</ul>
routes.rb:
devise_for :users
get "admin/galeriju_red"
resources :posts
get "admin/rakstu_red"
get "home/par_skolu"
get "home/personals"
get "home/kontakti"
get "home/pers_pieeja"
get "home/galerijas"
get "home/index"
The only idea I can think of is changing your routes from:
to
They are equivalent, but match makes path helpers available, so your links in menu view could be like this:
Main_app is a built-in Rails helper and it gives access to Rails routes inside Engine.
If you matched simply /home, path helper would be called home_path.
I hope this fixes your problem.
Reference: Routing in Rails