Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Can you give a little more detail on what's going on? What do you mean by refresh?</p> <p>Update: In that case I believe the simple answer is no. "Each request is treated as an independent event and no state information is carried over apart from what is stored in the user session and any external databases, caches, or file stores. It is best that you design your application with this in mind and not expect things to persist just because you've set them." (source: <a href="https://stackoverflow.com/questions/2791093/what-data-if-any-persists-across-web-requests-in-ruby-on-rails">What data (if any) persists across web-requests in Ruby on Rails?</a>). The only other thing I can think of to allow the "cards" data to persist across requests is by using a cookie. But then you'd have to keep updating the cookie info anyway I believe. So it may be better or not depending on what your situation is. </p> <p>Update: I've been thinking...One possible way to have a "card deck" persist is to try something like the following:</p> <pre><code>#config/initializers/card.rb - store an instance to an app-wide Card object using an initializer. THE_CARD_DECK = Card.new #Now we change the before filter which sets the @cards variable to use that constant: class ApplicationController &lt; ActionController::Base before_filter :init_cards def init_cards @cards = THE_CARD_DECK end end </code></pre> <p>Now @cards should be the sole card deck and you can change its value throughout the game. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload