weathertopper / family-photo-project

0 stars 0 forks source link

EDIT- 'Create' chaining #6

Open weathertopper opened 7 years ago

weathertopper commented 7 years ago

Again, I reckon grandma won't want to create every person and then hook them into the family tree. Add an option to 'Make a Person' while creating new offspring and spouse branches

weathertopper commented 7 years ago

http://stackoverflow.com/questions/26321437/ruby-on-rails-chaining-3-actions-from-one-button

I'll need to chain more than just this, but it's all about the same.

weathertopper commented 7 years ago

http://stackoverflow.com/questions/7218940/rails-3-how-do-you-create-a-new-record-from-link-to link_to is even better

weathertopper commented 7 years ago

Let me change the purpose of this issue. I would rather a marriage/descendant branch be created during the creation of a relative -> ie both people involved in the branch are already made. Why? Because that way, Grandma can't chain through, like, 15 relatives before remembering who she was trying to make in the first place.

So relative-creation-chaining will not be allowed. With that being said, Other types of objects can be made from the new/edit of a relative-- MarriageBranches and DescendantBranches (and Events w/ EventTags, I reckon). Similarly, Photos can be created with PhotoTags.

weathertopper commented 7 years ago

Ok, I rubber-duck debugged this. So let me explain what I REALLY want.

I want forms inside of the Relative and Photo 'new'/'edit' that correspond to the 'new/edit' of MarriageBranch, DescendantBranch, Event, EventTag, and PhotoTag (respectively, sort of).

The forms are easy enough to toggle in the UI.

The hard part will be getting the Relative/Photo controllers to (1) accept the extra params for the other objects, (2) accept >1 set of said extra params for >1 Tag/Event, and (3) properly chain to each Event/Tag 'create'

I could bypass this for now, however, by decreeing that photos and people (and events) have to be made before they can be tagged. In other words, I would make Grandma create a relative before connecting him/her to the family, and I would make Grandma upload a photo before separately tagging relatives in said photo.

For event, the steps would be create Relative -> create Event -> Add Tag. ''Add Tag" could just be a button next to the event in the Relative 'show', creation of the tag would follow the steps in the link-to stack overflow link above

weathertopper commented 7 years ago

^^ the same logic holds for creating PhotoTags in the Photo 'show' and DescendantBranches (both directions) in the Relative 'view' because these tags really are just connections.

weathertopper commented 7 years ago

For now, I am going to follow the bolded text above because it's easier. I'm too far away from a working product right now to go down the rabbit hole for an avoidable feature.

weathertopper commented 7 years ago

This won't work by itself. I need some form of 'chaining' to create/update/delete the 'updated' events and tags (ie events and tags concerned with births and deaths).

For this, I should look at custom routes and logic in the controller.

weathertopper commented 7 years ago

TRANSACTIONS- MAKE CHANGES IN MODEL DUUUUUH! http://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html