I wonder... Is there a possibility that if your database has multiple 
tables that are related with foreign keys,
whilst a user is filling in fields of forms, etc - is it possible for 
another web user to overwrite records or to create 
records with the same id that would later get overwritten by the 'slow' 
user.

In general, is there a potential database consistancy problem with multiple 
Rails web users. If so, what is the 
solution. I have never seen this discussed in any Rails book I've read.

-joe


On Monday, November 19, 2012 9:24:27 AM UTC-8, Ruby-Forum.com User wrote:
>
> Hi, 
>
> I'm not surely if I'm going to be able to explain well ... 
>
> We have a Rails 3.2 with backend PostgreSQL. 
>
> We have 5 models that are nested/related between them, and all must be 
> created/updated/destroyed in block, like a transaction. 
>
> Those models are created using very complex views and some modals, this 
> is for a very complex ERP. 
>
> We don't want to store 'invalid data' in the real tables, like using 
> some attribute like 'pending' or 'modifying'. 
>
> One solution that I'm experiment with it, and it seems it can serve us, 
> is using schemas of PostgreSQL. I have defined in a new schema the same 
> tables that we need for this purpose. 
>
> In Rails, I duplicate de Model (it's not DRY anymore...) with almost 
> same attributes but using the schema.table notation for the model. 
>
> When I create a new block set, simply I use the 'new_model_schema' 
> variatons, and finally, when I want to save, simply Insert all the rows 
> from this schema to the real schema (public in our case), all wrapped in 
> a block transaction. 
>
> But if we have to modify, we have to move all possible data to the new 
> schema, make there all the changes, and if it's validated, update the 
> values in the public schema. 
>
> This is not DRY, we have to have duplicated tables in two schemas, and 
> we have to duplicate models in Rails, and of course, controllers, and 
> views. 
>
> This approach maybe works but at the end will be a pain to maintain ... 
>
> What alternatives we have ? 
>
> A Javascript MVC framework like backbone.js will help us ? 
>
> In this case we have to duplicate some code also with model/views in 
> backbone, but at the end, the Rails controllers/views stay the same. 
>
> How are you solving this kind of complexity ? 
>
> Thanks for your time and help! 
>
> regards, 
>
> -- 
> Posted via http://www.ruby-forum.com/. 
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/iSAzw2_s7psJ.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to