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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:12:20+00:00 2026-05-15T08:12:20+00:00

at the top of my controller, outside of any method, I have @@javascript_is_disabled =

  • 0

at the top of my controller, outside of any method, I have

    @@javascript_is_disabled = false

and I have methods that that the view calls and invokes something like this

    @@javascript_is_disabled = params[:javascript_disabled]

but when I need the @@javascript_is_disabled in completely different method.. it is always false.

I know it changes in the method with params args… cause those methods behave differently, and appropriately

And ideas?

  • 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-15T08:12:20+00:00Added an answer on May 15, 2026 at 8:12 am

    The variable @@javascript_is_disabled is a class variable and it refers to a different thing depending on where you access it from. From within the Controller class body it doesn’t refer to the same thing as when you use it from within a controller method or a view. This is actually a pretty complex subject involving Eigenclasses

    I suggest implementing it using a view helper or a protected method:

    protected
    
    attr_writer :javascript_is_disabled
    def javascript_is_disabled
      # Replace false with your intended default value
      @javascript_is_disabled.nil? ? false : @javascript_is_disabled
    end
    

    Then you can reference it from within your views and controller action methods like an attribute javascript_is_disabled = true or if javascript_is_disabled ...

    You could also leave out the attr_writer ... part and just always remember to assign values to the instance variable @javascript_is_disabled = ...

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

Sidebar

Related Questions

I would like to have a view (Hierarchy structure) under Navigation Controller (the top
I'm building a controller/view that provides a wide selection of player rankings (e.g. Top
I have a view controller hierarchy and the top-most controller is displayed as a
I have a controller with a method that handles incoming GET data, stores some
Okay, so I have a UITableView hierarchy. The top level controller is for Categories,
I have a navigation controller-based app in which I would like to temporarily disable
NavigationControllers have ViewController stacks to manage, and limited animation transitions. Adding a view controller
I have a UIWebView in the detail view of my split view controller application.
A very peculiar bug: I have BarButtonItem which pops out a UIPopoverController like that:
How can I get any controller in UINavigationController? I can easily get top controller

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.