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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:54:38+00:00 2026-06-10T11:54:38+00:00

I am probably missing something extreamly obvious, but I can’t figure this our for

  • 0

I am probably missing something extreamly obvious, but I can’t figure this our for the life of me…

I am trying to preform a simple before_filter check in my Orders_Controller, to see if the Devise current_user.vendor_id == params[:vendor_id]. It returns false every time, redirecting my to the root_path, as I have it set up in my orders_controller…

before_filter :check_vendor
.
.
.
private

def check_vendor
 unless current_user.vendor_id == params[:vendor_id]
  redirect_to root_path, :flash => { error: "Sorry, but you don't have sufficient privlidges to view that page" }
 end
end

The strangest thing is when I login with a user, and navigate to

http://localhost:3000/vendors/3/orders/

and have this code in my index:

<%= current_user.vendor_id %> <%= params[:vendor_id] %>

It prints out on in the orders#index view:

3 3

Which should mean that when I use the same logic in the controller, it see’s that both values are ‘3’ (or whatever the current_user.vendor_id and params[:vendor_id] is)

Any help would be greatly appreciated 🙂 Sorry if it is an obvious answer, I am pretty new at Rails still.

  • 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-10T11:54:39+00:00Added an answer on June 10, 2026 at 11:54 am

    Are you sure you’re sending de param[:vendor_id] in the first request to the controller?

    I would add gem 'debugger' to my gemfile, run bundle install, and put debugger just above the comparisson in the before_filter.

    Then check params and current user values.

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

Sidebar

Related Questions

Probably missing something pretty obvious but I can't figure out what is going on.
I'm probably missing something obvious here but here's what I'm trying to do. From
This is with SBCL 1.0.55 on Debian squeeze. I'm probably missing something obvious, but
Probably I'm just missing something obvious, but I can't get the image in my
Okay, I'm probably missing something really simple here, but I've been at this for
I'm probably missing something obvious, but I can't see any difference between std::condition_variable and
I'm probably missing something simple here, but I can't find the answer elsewhere. I
I'm probably missing something, but I can't make a simple SQL query work. I
I'm probably missing something really obvious here, but I've been going over this over
Complete beginner so I'm probably missing something obvious but... I can't seem to combine

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.