Rails: How to store data in session?

ruby-on-rails, session

Solution

To store something in a session you can do:

session[:answer] = "some answer"

Then you can call the answer with:

session[:answer]

Or you could use HTML5 localstorage:

<script>
  localStorage.setItem("essay", "text");
  localStorage.getItem("essay"); // => "text"
</script>

Problem

I'm making an writing exam practice web app in Rails. The problem is that if users' answers are submited to the Internet, they will easily be detected by ETS. So when users write their answers again in real test, ETS will think they are coping answers from Internet and give them a fairly low score. My approach to this, is to store users' eassay in session. So it will not be upload to Internet at all. But, how can I store an object in session?

Original source

Related problems