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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:19:29+00:00 2026-05-25T16:19:29+00:00

This might be very simple; I don’t know Rails very well. I have a

  • 0

This might be very simple; I don’t know Rails very well.

I have a match myController/myAction/myID in my routes.rb that will direct hyperlinks to the proper page (using link_to). But here’s the problem: I don’t want people to be able to freely modify the id parameter, passing in via the URL whatever they like.

Is there a way to perhaps restrict access to routes to the link_to method only? Or maybe there’s another way to go about this, using a passed in hidden variable param or something?

  • 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-25T16:19:30+00:00Added an answer on May 25, 2026 at 4:19 pm

    Users access you site via urls like: /controller/action/:id right? A user can change an id and must not view another non authorized resource. How to achieve this?, on your controller, return only those resources that user is allowed to access.

    For example, suppose that you are using devise:

    class AController < ApplicationController
    
      def index
        @resouces = current_user.find_all_by_id params[:id]
      end
    end
    

    This way if the user tries to access something he does not have access to, he will get an error.

    Hope this helps, if not please let me know and I’ll try to elaborate.

    About current_user, yes it is supposed to be the current logged in user, it doesn’t have to be devise, you can implement your own session handling logic and then create a helper method to retrieve the currently logged in user.

    About using devise, if you don’t want to implement your own session handling logic, plus if you want features like:

    • remember me
    • already created views that you can fully customize
    • authentication
    • authorization
    • password encryption
    • many more (please look at the docs for further information)

    Then devise is a good way to go.

    Also, it is always a great idea, if possible and as a learning exercise, implement your own authentication and authorization layers, you won’t regret.

    Best regards

    Emmanuel Delgado

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

Sidebar

Related Questions

I know this might be very easy to some,, I have a simple string
The answer to this might be very simple, but I don't know it. The
I know it might be a very simple solution for this, but I am
This might be a very simple thing. Check out the normal sql query below
I know, this might be a very basic question but I am not 100%
This might be a very vague question but I guess I don't really understand
This might be a very simple request so apologies if it is. I'm using
I have this very simple Javascript to write on a text area when the
This might be a very simple thing that I'm overlooking, but I just can't
So, this might be a very simple question but I'll ask anyway. And this

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.