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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:43:09+00:00 2026-05-22T22:43:09+00:00

maybe someone did this before me, i cant handle with this. I have system

  • 0

maybe someone did this before me, i cant handle with this.
I have system where many users, admins. Im using extJS, JSON, Rails.

So, my question is: How in rails i can do that www.mysite.com/user/54/?format=ext_json&_dc=1306937167419&start=0&limit=50&fields=["respondent[email] CAN SEE ONLY ADMINS and just average users can see text “Sorry, only admins” ??

if simple, *.json pages can see only admins.

this is my controller

  def uz   
    @answers      = Question.find(params[:id])

    if session[:user].is_admin == 1

    end

    respond_to do |format|
      format.ext_json { render :json => @answers.to_ext_json(:class => Answer, :include => [:respondent]) }
    end
  end

im tried this (create before_filter) but nothing

  def checking
    if session[:user].is_admin == 1
        WHAT TO DO HERE
    end
  end
  • 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-22T22:43:10+00:00Added an answer on May 22, 2026 at 10:43 pm

    You can create before_filter in controller where you can check format, action and session and return 404 error page

    http://apidock.com/rails/ActionController/Filters/ClassMethods/before_filter

    before_filter :admin_required
    
    ...
    
    private
    def admin_required
    
    
      case params[:format].to_sym
      when :ext_json 
         #....redirect with eror or something if not admin
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Maybe someone can clear me up. I have been surfing on this a while
I have no clue why this is happening but maybe someone here knows. I
I find this question a little tricky. Maybe someone knows an approach to answer
I am writing my first FireFox extension and I have some questions. Maybe someone
I am using a jQuery Ajax control from this site http://abeautifulsite.net/2008/03/jquery-file-tree/ I have it
Maybe someone can explain this behavior. Sometimes I will do an SVN update, and
I have used this tutorial before for adding registration fields to the Magento registration
maybe someone can help me: i'm using the rest server from here: https://github.com/philsturgeon/codeigniter-restserver .
I thought I'd post here in the hope that maybe someone with MVVM expertise
I'm having trouble groking something in Linq - maybe someone can give me some

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.