activerecord - How to track WHEN a model attribute changes using Rails 4? -


I have to find a way to track specific moments in which a model feature has changed from state to state, for example Suppose I have a list model with a feature called voting_status , which can be true

    Code> or False .
  • That attribute can be changed by the owner of the list of true to the false button pressed , so that other users can start voting on it. .
  • On receiving the first user vote, voting_status turns back and other users can no longer vote, even if they did not get the chance to vote in the first place.
  • That's why I want to say a if that it checks that the user has voted between the moment at which the owner clicked the button and now another model I have called the vote , which votes to that user and voted for.
  • Pseudo-code will look something like this: Vote = Vote. FINDB (User_ID: 4) list = list.find (5) if voted. Sequenced_it-bitine list.vitting_status_cheid? Unfortunately, I do not have any when the method is not found, or something that can return to the date in which the owner has given that button This is how the attribute is updated.

    Any thoughts? Thanks.

    You will need to use one of the following gems to keep track of the changes.

    All the above gems work for you Crawled

    Edit: I have not used it, but you can also try the gem.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -