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 7813891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:01:06+00:00 2026-06-02T05:01:06+00:00

So I have 3 types of users: admin moderator regular user I have the

  • 0

So I have 3 types of users:

admin
moderator
regular user

I have the moderator and admin pages locked with a controller-wide system like this:

def authorize
  unless User.find_by_id(session[:user_id]) and User.find_by_id(session[:user_id]).moderator == true
    redirect_to login_url, :notice => "Please log in with a moderator account"
  end
end

def authorize_admin
  unless User.find_by_id(session[:user_id]) and User.find_by_id(session[:user_id]).admin == 1
    redirect_to login_url, :notice => "Only admins can access the page you tried to access"
  end
end

But I need to give access to the regular user to the edit pages (and of course the update action) of multiple controllers. But just edit and update.

If I do:

before_filter :authorize, :except => :edit

Then anyone (even if not logged in) has access to those pages.

How would I go about doing something like that?

Edit

As per Thilo’s suggestion, I added the following to the application_controller.erb file:

  def update_successful
    skip_before_filter :authorize
  end

To be able to serve the update_successful page after a regular user has edited an entry. However I get this error:

undefined method `skip_before_filter' for #<HomeController:0x007ff782aeb6f0>
  • 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-06-02T05:01:07+00:00Added an answer on June 2, 2026 at 5:01 am

    You can skip any globally applies filter explicitly:

    skip_before_filter :authorize, :only => [:edit, :update]
    

    Or don’t apply it to the relevant actions in the first place:

    before_filter :authorize, :except => [:edit, :update]
    

    EDIT

    To answer your further question: Add this to your application controller:

    def upload_successful
    end
    

    This is an empty method that explicitly defines the action that so far as been implicitly be used by Rails when rendering the home/upload_successful.html.haml template. Then, remove authentication from that method by modifying your filter:

    before_filter :authorize, :except => [:upload_successful]
    

    Here’s a good introduction to rendering in Rails – it helps to understand rendering by default, which is what your upload_successful template has been displayed without having a matching controller or action defined.

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

Sidebar

Related Questions

I have an asp.net website with different user types like admin, registered user. Each
I have an application where there are two types of user currently, Admin and
I have two types of users for my system, normal human users with a
The system will two types of users. Admins and normal users. Admins can have
Here is an abstract example: 2 types of users ( user and admin )
If I had a user resource, I might have a page like /users/1. What
I have 3 types of users: Admins Suppliers Employees Each user type will have
In my ASP.NET MVC 3 application i have two types of users - regular
I have a simple model like this class UserType( models.Model ) : def __unicode__(
I am building an app that has two types of users: regular users (have

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.