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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:56:39+00:00 2026-05-23T04:56:39+00:00

I am working on a paperchase / treasure hunt mobile web app. I have

  • 0

I am working on a paperchase / treasure hunt mobile web app. I have basic authentication, if the user scans any of the following codes he will be directed to the sign_up page. So far everything works fine but here comes the tricky part:

I have 10 QR-Codes, every single one represents one URL.

  1. QR-Code ID:1 URL:http://paperchase.heroku.com/qrs/4975
  2. QR-Code ID:2 URL:http://paperchase.heroku.com/qrs/2368
  3. QR-Code ID:3 URL:http://paperchase.heroku.com/qrs/2317
  4. QR-Code ID:4 URL:http://paperchase.heroku.com/qrs/2369
  5. QR-Code ID:5 URL:http://paperchase.heroku.com/qrs/6247
  6. QR-Code ID:6 URL:http://paperchase.heroku.com/qrs/1493
  7. QR-Code ID:7 URL:http://paperchase.heroku.com/qrs/1759
  8. QR-Code ID:8 URL:http://paperchase.heroku.com/qrs/4278
  9. QR-Code ID:9 URL:http://paperchase.heroku.com/qrs/8912
  10. QR-Code ID:10 URL:http://paperchase.heroku.com/qrs/5346

Now I want the user to scan every single code in the shown order. If he scans Code 1, he will find the directions to Code 2, if he scans Code 2, he will find the directions to Code 3 and so on. But right now it is possible to skip codes, e.g. you could scan code 10 after code 1 and win.

The solution I came up with:

All QR-Codes are set to false. If you scan QR-Code 1, it will be set to true and you can scan QR-Code 2. If you now want to scan QR-Code 5, it redirects you to the root_path because QR-Code 4 is set to false.

This is part of my User model:

  ...
  t.boolean :qr_01, :default => false
  t.boolean :qr_02, :default => false
  t.boolean :qr_03, :default => false
  t.boolean :qr_04, :default => false
  ...

Now I think that I have to write some kind of before_filter with the logic (setting QR-Codes to true, checking if all the prior QR-Codes are set to true) But I have no clue how it should look like.

Thanks in advance

  • 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-23T04:56:40+00:00Added an answer on May 23, 2026 at 4:56 am

    Why not just store one int field in your model?

    For example if my User model had

     t.integer :qr_code
    

    You could simply check inside your controller action:

    def add_qr
      user = User.find_by_id(params[:id])
      if user.qr_code != params[:qr_code]-1
        redirect_to(some_url)
      else
        user.qr_code+=1
        user.save
        #do whatever else you need to do and display view
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working on a new app and using restful-authentication. I was trying to make it
Working with some basic java apps on CentOS 5 linux and I have my
Working in Eclipse on a Dynamic Web Project (using Tomcat (v5.5) as the app
Working on a mobile app that needs to use a public API for accessing
Working on a multi-tenant app where most of my models will have a tenant_id
Working in an app where a page_title method was defined in application_helper.rb as such:
Working with a Lucene index, I have a standard document format that looks something
Working in Java: I have a JFrame class, and separate classes for my two
Working on my first Android app and facing a challenge. I am pulling calls
Working on game. I have a movable basket and a - for now -

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.