Note that there are some explanatory texts on larger screens.

plurals
  1. POGood Ideas for Automating Common CRUD Operations in Rails
    primarykey
    data
    text
    <p><em>Short version</em>: What are some good ways to allow the end user to define "processes" or sequentially executed CRUD operations in a fairly large project, so they can build <em>templates</em> for common processes (like creating 2 tickets for each new event posted automatically)? Something like <a href="http://cukes.info/" rel="nofollow noreferrer">Cucumber</a>, but for CRUD operations..., or even <a href="http://www.bukisa.com/articles/100688_automate-your-web-browser-actions-by-selenium" rel="nofollow noreferrer">Selenium</a>?</p> <p>Here's the situation:</p> <p>I have inherited a very large project (the <a href="http://spreecommerce.com/" rel="nofollow noreferrer">Spree eCommerce project</a>), which I am modifying for a client. It's a very complex and very nicely done project. Most/all of the workflows for creating <code>Products</code>, <code>ProductGroups</code>, categories, etc., are very well defined, which means they could be automated.</p> <p>So my client wants to be able to say "when I create a new <code>Event</code>, I want it to create this too:</p> <ul> <li>Two tickets: 1 for $400, one for $500, which go on sale X and Y time after we create the event</li> <li>If it's <em>this</em> <code>Event</code>, also create this "early-bird" special."</li> </ul> <p>This translates to <code>create/save</code>-ing 4, maybe more, models in Spree: <code>Event, Product, ProductGroup, ProductProperty</code>.</p> <p>If I were to manually solve this edge case, I'd have to write quite a bit of code and do some serious refactoring (or copy-pasting) to make it so my client could create their tickets for each event they create. But what about the next case, "I want it to categorize each Ticket under <em>this</em> and <em>that</em> based on the event <code>date</code>, <code>location</code>, and <code>meta_keywords</code>." Now I have to start all over again...</p> <p>What I want to be able to do for them is allow them to configure all this stuff, so they can define:</p> <ul> <li>all kinds of default values to fill in product descriptions, prices, etc.</li> <li>to create X number of products based on the title of the Event.</li> <li>maybe some more things later.</li> </ul> <p>The end result of all this is, Admin fills out one form, and it fills out 5 forms in the background (things that they don't need to know about necessarily, but need to be done).</p> <p>I don't know the best or most common way to do this. I'm figuring it out as I go, but I'm sure many of you have some good ideas for this.</p> <p>So the question(s) are:</p> <p><strong>What is the best way to make all of this configurable?</strong></p> <p>Spree has many of the methods I'd need buried inside of controllers, so it seems that a good practice would be to not include any methods in the controller, only references to methods in Modules (so you could reuse it everywhere). Unless you were allowed to chain multiple <code>redirect_to</code> calls together, which you're not.</p> <p>Are there any examples of something with this kind of configurability for the end user? Something like ERB templates for sequential CRUD operations?</p> <p><strong>Do I really need to code all of these cases manually?</strong></p> <p>The example above (of creating 2-3 tickets per event based on some property values) is pretty specific. Have any of you been able to create a system that's this configurable? The end goal would be for them to be like "oh, I've done this more than once, let's just make a template for this Event so next time it creates everything I did".</p> <p>Just looking for some sort of push in the right direction, or some good examples on workflow automation. Something like <a href="http://cukes.info/" rel="nofollow noreferrer">Cucumber</a>, but for CRUD operations...</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload