Ruby on Rails
Sunday, August 6, 2017
Hi
-- Actually there is no status column exists in slot model. I have added column for the sake of this functionality. Now, I want to know whether we can achieve same functionality without using any persistent storage?
On Saturday, 5 August 2017 23:21:56 UTC+5:30, Hassan Schroeder wrote:
On Saturday, 5 August 2017 23:21:56 UTC+5:30, Hassan Schroeder wrote:
On Sat, Aug 5, 2017 at 10:23 AM, siva subrahmanyam
<subbu98...@gmail.com> wrote:
> Sorry for the confusion. Currently, I solved (just avoided concurrency)
> issue by adding a status column to slot model. So when a user trying to
> purchase that slot I update status column to hold so that other user don't
> able to book same slot at the same time.
Seems fine. Though didn't you need a field before to hold the
booked/not-booked status of the slot? which could be "pending"
as well?
> Now I want solve the same problem without adding DB column.
Why? If the "status" is an attribute of the model, why would you
*not* keep it in the DB?
It has to be persisted somewhere, and sure, you *could* use a
key-value store like Redis but what is the point? Seems like an
unnecessary complexity.
--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/14528183-4376-4b04-9bb5-defb7740dc9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment