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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:34:27+00:00 2026-06-13T20:34:27+00:00

Right now, I have some tooltip JavaScript that I’d like to run on every

  • 0

Right now, I have some tooltip JavaScript that I’d like to run on every page of my app, but only if the current user’s model has User.advanced_tooltips set to true in my database.

What is the best way conceptually to get this JavaScript to trigger conditionally based on a value in a database? I’m having some real trouble getting JavaScript and Rails to communicate.

  • 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-13T20:34:28+00:00Added an answer on June 13, 2026 at 8:34 pm

    Here’s the solution I ended up using (given the very weird constraints imposed by this project):

    First, I set up a controller route that finds the current User and then renders its advanced_tooltip value as text.

    Then, in my application.js, I made an AJAX call using $.get to that route, then checked whether the result == “true” to determine whether or not a user had advanced tooltips enabled.

    It’s a messy solution (and those listed above are actually better), but since I had some very rigid restrictions due to me jumping onto someone else’s project’s mid-completion, it’s what I had to do.

    Still gave both comment up-votes, as they’re valid and would totally work under normal circumstances.

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

Sidebar

Related Questions

Right now I have these buttons that line up nicely, but they have some
Right now I have some libraries that link easily to Visual Studio projects but
I have some code right now that executes when a link is clicked. The
I have some code that shows results in a table Right now it will
Right now I have some links to move to a Previous page or to
Right now I have some functionality working but its really ugly and I know
I have some Objects that Expire after a certain amount of time. Right now
Right now I have some TabItems in my App which are implicitly styled. I
Right now I have some major code changes that won't be done in time
Right now I have some code that generates <li> elements that have a height

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.