Ruby on Rails Saturday, August 27, 2016

Im working on a website that is a recipe database and want the users to be able to submit changes to the recipes and other users can vote on the changes.  However the various methods Ive been trying I come across limitations and wondering what the best method would be to handle this and looking for some advice on how to attack this problem.  Here is some info on my setup:

Database Structure:
Recipes table - has columns for singular items like servings, cook time, description, photo, etc
RecipeIngredients table - just like it sounds, holds all the ingredients for all recipes has amount, unit, name, recipe_id columns
RecipeSteps table - same as ingredients has order and description columns


Here is the various details/issues of the feature Im looking to implement and what is causing me problems:
1. Initially was going to have an ingredient_change and step_change table and address individual changes to items...but an ingredient change can effect the steps so needed to have a single change with multiple items
2. Looked at recreating the entire recipe everytime there is a change submitted but that seemed like an excess of storage and would eventually cause the database to be way to big
3. Currently Im trying to have a simgle change table that stores the changes as a json string but having a lot of trouble figuring out how to implement it and build a form that has all the ingredients and steps that changed and save it as a json.

So to sum up and hopefully clarify some.  Im hoping to get some help on figuring out a way to go about allowing users to change something on the recipe, save just the changes to a database and know what is different about the changes to show the users who vote.  Hopefully this is clear enough to understand

--
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/51f5a38d-5d12-4845-a4af-1d974463fe59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment