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

The Archive Base Latest Questions

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

So lets say I have a form for submitting a new post. The form

  • 0

So lets say I have a form for submitting a new post.

The form has a hidden field which specify’s the category_id. We are also on the show view for that very category.

What I’m worried about, is that someone using something like firebug, might just edit the category id in the code, and then submit the form – creating a post for a different category.

Obviously my form is more complicated and a different scenario – but the idea is the same. I also cannot define the category in the post’s create controller, as the category will be different on each show view…

Any solutions?

EDIT:

Here is a better question – is it possible to grab the Category id in the create controller for the post, if its not in a hidden field?

  • 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-25T17:29:45+00:00Added an answer on May 25, 2026 at 5:29 pm

    Does your site have the concept of permissions / access control lists on the categories themselves? If the user would have access to the other category, then I’d say there’s no worry here since there’s nothing stopping them from going to that other category and doing the same.

    If your categories are restricted in some manner, then I’d suggest nesting your Post under a category (nested resource routes) and do a before_filter to ensure you’re granted access to the appropriate category.

    config/routes.rb

    resources :categories do 
      resources :posts
    end
    

    app/controllers/posts_controller

    before_filter :ensure_category_access
    
    def create
      @post = @category.posts.new(params[:post])
      ...
    end
    
    private
    def ensure_category_access
       @category = Category.find(params[:category_id])
       # do whatever you need to do. if you don't have to validate access, then I'm not sure I'd worry about this.  
       # If the user wants to change their category in their post instead of 
       # going to the other category and posting there, I don't think I see a concern?
    end
    

    URL would look like

    GET
    /categories/1/posts/new
    POST
    /categories/1/posts

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

Sidebar

Related Questions

Lets say I have a form: <form id=form1 method=post> <ul> <li class=button> Button 1!
lets'say i have a form, with like this : <form name=frmMail method=POST action=save.do dojoType=dijit.form.Form
Lets say we have a web page with a search input form, which submits
Lets say i have a html file that contain a form: <form method=post action=url>
Lets say i have a form which have the following : Name:TextBox Email:TextBox Age:TextBox
lets say i have a main form which have a lot of functionallity. this
Lets say I have a really simple html form: <form action=./whatever.php method=POST> <input type=submit
For simplicity lets say I have two flex mxml pages. form.mxml button.mxml If the
I have a few text boxes and buttons on my form. Lets say txtBox1
I have a form that is generated on a customer's website (lets say customer.com)

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.