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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:33:52+00:00 2026-06-01T02:33:52+00:00

My Rails 3 app solves a variant of the board game ‘Boggle’. Each request

  • 0

My Rails 3 app solves a variant of the board game ‘Boggle’. Each request involves thousands of dictionary lookups. What’s the best way to persist the large dictionary object between requests?

My dictionary is implemented in a Trie, which works great. The problem is, the Trie takes about 30 seconds to build (big dictionary). How can I persist one dictionary between requests? The Dictionary is just a plain Ruby object, not ActiveRecord.

I’d like to keep the dictionary in the Rails app in this case, even though I suspect the standard approach is to delegate dictionary lookups to another process (is it?).

Thanks.

  • 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-01T02:33:53+00:00Added an answer on June 1, 2026 at 2:33 am

    It’s perfectly reasonable to have a plain old ruby object or class act as a Rails model.

    If your dictionary is implemented with class methods then that becomes very easy. Move it into app/models and Rails will autoload the class and make it available to your controllers. Add an initializer to config/initializers and you can ensure the the dictionary is loaded when your Rails app starts up.

    If your dictionary is actually an instance of a Dictionary class then this isn’t as helpful. You’re probably best off initializing it as a global constant. Yes I know that we’re all trained to wince at the idea of globals these days; but the fact is that a single (presumably immutable) application dictionary does in fact need to be loaded into memory and globally available. Just make sure that you name (and maybe namespace) it in a way that’s likely to avoid confusion or conflicts.

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

Sidebar

Related Questions

Our rails app is designed as a single code base linking to multiple client
My Rails-app has a sign in box with a remember me checkbox. Users who
My Rails app has some pages which are SSL-required and others which are SSL-optional.
A rails app I'm working on features examples of quadratic equations. Obviously, these are
In my rails app I use the validation helpers in my active record objects
On my rails app I have a list of items (like a task list)
I have a rails app that I have serving up XML on an infrequent
I have a Rails app that I have successfully tested with Mongrel and Webkit.
I have a Rails app that I need to deploy. Here are the facts:
I have a rails app that has picked up a bit of traction, but

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.