Routing issues in Rails when a Blog component was added -
the app working fine until added blog. then, started having routing issues. every link on navbar still works fine, including blog link, opens index of of posts. when click on 1 of links go specific post, page displays, should. but, in order user make comment, he/she needs login or signup. so, put 2 links on page. problem when click on 1 of these links, or other link on navbar, error message, typical message follows:
couldn't find post id=login
at point, not @ root anymore. in instance, address bar reads:
http://localhost:3000/posts/login
the way root clicking ‘back’ link on page , takes user blog index page.
this routes file looks like:
septactus::application.routes.draw devise_for :admins devise_for :users, :path => "auth", :path_names => { :sign_in => 'login', :sign_out => 'logout', :password => 'secret', :confirmation => 'verification', :unlock => 'unblock', :registration => 'register', :sign_up => 'cmon_let_me_in' } devise_for :users, :controllers => {:registrations => 'registrations'} match '/home', :to => 'site_pages#home' match '/about', :to => 'site_pages#about' match '/bookshelf', :to => 'books#index' match '/blog', :to => 'posts#index' match '/icasts', :to => 'site_pages#icasts' match '/portfolio', :to => 'site_pages#portfolio' devise_scope :user match "login", :to => 'devise/sessions#new' match 'logout', :to => 'devise/sessions#destroy' match 'signup', :to => 'devise/registrations#create' end resources :site_pages resources :books resources :users resources :posts resources :comments end root :to => 'site_pages#home' end
any clue, anyone?
here problem in line:
<p>to add comment, <%= link_to 'login', 'login' %> or <%= link_to 'signup', "signup" %></p>
you need change to
<p>to add comment, <%= link_to 'login', login_path %> or <%= link_to 'signup', signup_path %></p>
Comments
Post a Comment