Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6789781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:38:44+00:00 2026-05-26T17:38:44+00:00

Inside my controller I have the following: before_filter :authenticated?, :only => [:edit] def authenticated?

  • 0

Inside my controller I have the following:

  before_filter :authenticated?, :only => [:edit]

 def authenticated?
    if current_user != User.find(params[:id])
      flash[:alert] = 'Log in!'
      redirect_to login_path :status => 401
    end
  end

Now when I am logged in and I go to edit the user everything works, but when I go to edit a user I shouldn’t be able to I get the following:

No route matches {:action=>"new", :controller=>"sessions", :status=>401}

Why is this? For reference I have included my rake routes below.

 users GET     /users(.:format)          {:action=>"index", :controller=>"users"}
        POST   /users(.:format)          {:action=>"create", :controller=>"users"}
new_user GET   /users/new(.:format)      {:action=>"new", :controller=>"users"}
edit_user GET  /users/:id/edit(.:format) {:action=>"edit", :controller=>"users"}
   user GET    /users/:id(.:format)      {:action=>"show", :controller=>"users"}
        PUT    /users/:id(.:format)      {:action=>"update", :controller=>"users"}
        DELETE /users/:id(.:format)      {:action=>"destroy", :controller=>"users"}
sessions POST  /sessions(.:format)       {:action=>"create", :controller=>"sessions"}
new_session GET/sessions/new(.:format)   {:action=>"new", :controller=>"sessions"}
session DELETE /sessions/:id(.:format)   {:action=>"destroy", :controller=>"sessions"}
   root        /                         {:controller=>"pages", :action=>"home"}
contact        /contact(.:format)        {:controller=>"pages", :action=>"contact"}
  about        /about(.:format)          {:controller=>"pages", :action=>"about"}
   help        /help(.:format)           {:controller=>"pages", :action=>"help"}
 signup        /signup(.:format)         {:controller=>"users", :action=>"new"}
               /signup(.:format)         {:controller=>"users", :action=>"new"}
signout        /signout(.:format)        {:controller=>"sessions", :action=>"destroy"}
 signin        /signin(.:format)         {:controller=>"sessions", :action=>"new"}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:38:45+00:00Added an answer on May 26, 2026 at 5:38 pm

    I don’t even see a login_path, you should be able to redirect to signin_path, though.

    In any case, is the :status part critical to your needs?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Inside my controller's action I have the following code: public ActionResult GridAction(string id) {
I have the following function inside my HomeController class: public class HomeController : Controller
I have the following code in my controller after the user posts the form
Inside my Table view controller I have following method -(BOOL)isValidCoordinate:(CLLocationCoordinate2D)coordinate { //This is just
I have a few methods inside my view controller that load up for future
Inside my page, I have the following: <aspe:UpdatePanel runat=server ID=updatePanel> <ContentTemplate> <local:KeywordSelector runat=server ID=ksKeywords
I have the following scenario I want to add methods dynamically to a controller.
i have the following foreach. Inside you'll see a text box for quantity. At
Hallo, I have following jquery code for calling ASP.NET MVC controller method that is
MVC 3. VB.NET I have the following controller action in my application to send

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.