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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:14:28+00:00 2026-06-09T14:14:28+00:00

I am not using a plugin and used instead the tutorial http://ruby.railstutorial.org/chapters for my

  • 0

I am not using a plugin and used instead the tutorial http://ruby.railstutorial.org/chapters for my administration. However the issue I am having is the following

class UsersController < ApplicationController
  before_filter :signed_in_user, only: [:index, :edit, :update, :destroy]
  before_filter :correct_user,   only: [:edit, :update]
  before_filter :admin_user,     only: :destroy

What I would like also is if you are admin_user to then be able to edit, and update the customer. But because of correct_user been used, It doesn’t work

I have try the following

def correct_customer
    @customer = Customer.find(params[:id])
    redirect_to(root_path) unless current_customer?(@customer) || customer.admin?
end

But then I have an undefined customer. What would be my best approach to allow the user if admin to modify a selected customer.

The error occurs if i click the a customer#edit (not me)

NameError in CustomersController#edit

undefined local variable or method `customer' for #<CustomersController:0xa51fd60>
Rails.root: /home/jean/rail/map
  • 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-09T14:14:29+00:00Added an answer on June 9, 2026 at 2:14 pm

    i think you’ve meant

    redirect_to(root_path) unless current_customer?(@customer) || @customer.admin?
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this great plugin: http://www.sanisoft.com/blog/2009/06/22/jquery-auto-correct-plugin/ But it's not working with 1.6.2 or greater...
I used to work with jQuery and was using jQuery LazyLoad Plugin http://www.appelsiini.net/projects/lazyload jQuery
I have a Coda slider on one webpage (hand-crafted, not using the plugin, but
I have tried using the accordion plugin, but it does not work, and I
When using the Groovy Jenkins plugin (not the Groovy Post Build Plugin, which is
So I'm using a template for a jQuery plugin and unfortunately it will not
I wonder, using Eclipse's PyDev plugin , how come documentation does not always show
I am using devise plugin in my new Rails App. My issue is devise
I am using Lazy Load Jquery plugin here on my test page: http://bloghutsbeta.blogspot.com/2012/03/testing-2_04.html And
I'm using supersized plugin http://buildinternet.com/project/supersized/ to obtain a fullscreen gallery. It works fine itself,

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.