Strange Routing error in rails 3. Rails changes the route that is specified -
i have rails 3 app, , when click link terms page, routes different controller, routes should use. stranger still, route works when i'm not logged in, , i'm using devise.
i error when clicking link when i'm logged in.
no route matches {:action=>"edit", :controller=>"users", :id=>nil} <%= link_to "terms", terms_path %>
routes (in order appear in routes.rb):
devise_for :users, :controllers => {:registrations => "registrations"} resources :users member :following, :followers post :accept end end match '/terms', to: 'static_pages#user_agreement'
static pages controller
def user_agreement end
rake routes
terms /terms(.:format) static_pages#user_agreement
this happens every other action i've routed way staticpages controller, not other actions route different controller.
update: terms page header:
<%= link_to "follow", users_path %> <%= link_to current_user.name, current_user %> <%= link_to "sign out", destroy_user_session_path, :method => :delete %>
footer:
<%= link_to "welcome", welcome_path %> <%= link_to "settings", edit_user_path(@user) %> <%= link_to "terms", terms_path %>
all content pure html.
thanks in advance
you have link edit_user_path
no @user
hinted in comments.
you should using current_user
anyway.
Comments
Post a Comment