title: How to update one column depending on the value of second column in Rails
body: <p>I am building a small, language-learning app in Rails and have following problem. A model 'Flashcard' has two integer values in the database: 'counter' and 'level'.</p>
  
  <p>Counter indicates how many times a flashcard was seen. Level depends on the counter, for instance:</p>
  
  <p>if the counter is between 0 and 10, the level should be 1, </p>
  
  <p>if the counter is between 11 and 20, counter should be 2 and so on.</p>
  
  <p>My question is: how to update one column of the table depending on value from the other? </p>
  
  <p>I could probably use series of if statements or case statement but perhaps there is an easier way to set all this in Model.</p>
  
  <p>Thanks in advance.</p>