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
This approach maybe works but at the end will be a pain to maintain ...
What alternatives we have ?
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!
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 email@example.com.
To unsubscribe from this group, send email to firstname.lastname@example.org.
For more options, visit https://groups.google.com/groups/opt_out.