Yeah, it's a little different. the new/create_for_B goes in the C controller since it's acting on a C model, but routes like /Cs/new/B
Just remember it's just adding a custom route and looking for a parent id to assign but is otherwise a normal new/create of a C model. On Oct 4, 6:18 pm, Tuishimi <[email protected]> wrote: > Thank you for your response. I was looking at that... it looks as > tho' it works backwards? You would call the create_for_b from the > create in C? And where I get confused is does this happen behind the > scenes when you tap the create in C? I think the more I read about it > the more I confuse myself. I am probably over-complicating this in my > head. > > Let me read about them (owned actions) again... > > On Oct 4, 1:59 pm, kevinpfromnm <[email protected]> wrote: > > > sounds like you want owned > > actionshttp://cookbook.hobocentral.net/manual/controllers#owner_actions > > > this applies if the only time you'll be adding a B model is to an > > existing A record and similarly C for B. > > > On Oct 4, 2:26 pm, Tuishimi <[email protected]> wrote: > > > > I won't lie, I am struggling with Hobo, so please bear with me. I > > > feel like an idiot but here goes... > > > > I have three models: A, B and C. > > > > C belongs to B which belongs to A. > > > > C is a file uploader. I have a view/form to select a file which then > > > transfers control to the a method in the controller. This form > > > *should* have the id's for both B and A, but currently does not. > > > > I have created an upload method in the controller which uses CGI to > > > reference and load records from a file, creating and saving instances > > > of the model. It performs a few distinct validation passes on the > > > data. > > > > Currently, I have C creating the instance of B (it's supposed parent) > > > which should also reference the ID of A, B's parent. My current code > > > mostly works, does what I want but I know it is not good practice and > > > I want to improve it. > > > > I want to be able to list an instance of A, and hit "NEW B" which > > > generates a new instance of B WITH the parent already referenced, > > > saves it, then transfers control to the C view that has the form for > > > file upload. But how do I link the parent into the upload form to > > > pass on the new ID value for the parent, and accept some additional > > > data to back fill the parent class (I allow the user to also name the > > > upload for reference) without actually displaying a form for B? What > > > I mean is, once I click on new B from A, I want to create my new B, > > > fill in the parent ID from A all behind the scenes, no user > > > interaction is necessary, then immediately transfer control to C which > > > performs the upload but also updates the parent class (B)... > > > > Am I making sense? If not, please let me know and I will try to > > > restate my problem. -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
