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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:32:06+00:00 2026-05-25T20:32:06+00:00

I have various image galleries for different users. For the most part the complete

  • 0

I have various image galleries for different users. For the most part the complete page may be cached. However I also want the following features:

  1. If a user is logged in and visiting his own gallery, then the user
    can see an “x” delete link overlaying each image.

  2. If a user is logged in and on someone else’s gallery, then they can
    see overlays “thumb up”, “thumb down” voting for each image.

  3. If a user is NOT logged in, they can see the overlays for
    voting,
    however clicking on them will pop-up a login dialog.

The approach I have come up with is this:

  • In the server side erb template I will always generate the voting
    links and delete links regardless of login status, but I will have
    them hidden with css by default.
  • I will then reveal them using js
    depending on the user’s login status.

The question is… what is the best way of determining the user’s login status on a cached page? Can I use cookies over cached pages?

Would it work if I had a piece of javascript on the cached page that checked for a cookie value similar to this:

  if ($.cookie("user_id") == 23) { //if user is owner of this gallery...
     //reveal delete links, hide voting links
  }

I hate to build something special to set that cookie… there should already exist some type of DEVISE cookie right? How do I access it?

  • 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-25T20:32:07+00:00Added an answer on May 25, 2026 at 8:32 pm

    Use $.cookie("user_id") to set the cookie, use $.cookie("user_id", "23") to set a cookie. You should beware of unauthenticated abuse, though: Every credential-less request that requires authentication should be rejected, or the purpose of logging in will be defeated.

    If you want to check for the available cookies on your website, use this bookmarklet:

    javascript:alert(document.cookie)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a webapp where people can upload various image file types and on
I have a requirement to save an image file in various formats. The list
We have various related session variables for a complex page that has various things
I have a grayscale image which I want to use for drawing Cocoa controls.
I have a toolbar with various image buttons, created in Interface Builder. I'd like
I have the following code. It's used to combine various image attachments (and pdfs)
I have various image size files loaded on each URL and would like to
there are various good jquery image preview plugins out there. however, all of the
I have my own classes that represent image data. They have various underlying structure
I am trying to display an image using purely javascript. I have found various

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.