News for hackers. Stuff that matters.
Re:Learning Ruby: Things I Like, Things I Miss from Python by andi999 on Tuesday February 16, 2021 @10:06AM (#26154492)
Thanks. So typical CRUD applications usually run on luck? (or on not beeing unlucky if the average number of request per hour is not so high).
Re:Learning Ruby: Things I Like, Things I Miss from Python by msbarnett on Tuesday February 16, 2021 @11:58AM (#26155979)
Not really?

Most CRUD applications go the one extra step of putting a uniqueness constraint on the column instead of just relying on the app layer validation, and comparing hidden time stamps on the form if multiple people might edit the same row simultaneously. It’s exceedingly straightforward.

Did you really think thousands of web apps up to and including GitHub and shopify were squeaking by on blind luck? If basic database transactions and integrity weren’t doable in Rails, that’d have had to have been fixed years ago.

Re:Learning Ruby: Things I Like, Things I Miss from Python by andi999 on Tuesday February 16, 2021 @12:02PM (#26156024)
Any reference how this is best done with rails?
Re:Learning Ruby: Things I Like, Things I Miss from Python by msbarnett on Tuesday February 16, 2021 @12:28PM (#26156343)
Depends on what you mean by “this”, I suppose.

Most of your basic questions are covered by the starter Rails Guide for ActiveRecord, eg) transactions, validations, how to add a uniqueness constraint to the DB in a migration

https://guides.rubyonrails.org/active_record_basics.html

The ActiveRecord Queries guide also covers some mechanisms for handling row-level write contention

https://guides.rubyonrails.org/active_record_querying.html#l...