Thanks Kevin - I've got it working. Your advice is really appreciated. On Jun 22, 8:07 pm, kevinpfromnm <[email protected]> wrote: > it's related to context, so if you're talking an item in a collection, > the parent of an item in the collection would be the collection > itself. > > I think this is being made a little harder than need be, you've got a > collection of items that are all valid db objects (with ids and such) > and within each card, you want a form that can call with the current > object's id and the parent of that object's id right? The current > object should have the parent id already if that's the case. > > On Jun 22, 5:43 pm, Ronbo <[email protected]> wrote: > > > this_parent gives me an array of siblings. this_parent.name is the > > name of the current model, and this_parent.id is a large integer that > > changes (memory address of the array?) > > > Could this_parent be intended for has_many/belongs to associations, > > whereas I have a has_many through/has_many through? > > > On Jun 22, 6:38 pm, kevinpfromnm <[email protected]> wrote: > > > > Then you should only need the parent id, not the grandparent unless > > > you're trying to create a parent along with the child at the same > > > time... > > > > On Jun 22, 3:14 pm, Ronbo <[email protected]> wrote: > > > > > Yes, there is. The card is for the grandchildren collection, nested > > > > inside cards for the children of the parent. > > > > > grandparent to parent: has_one/belongs to > > > > parent to children is: has_many to has_many > > > > > On Jun 22, 4:56 pm, kevinpfromnm <[email protected]> wrote: > > > > > > Isn't there a db relationship between the grandparent and parent > > > > > already? > > > > > > On Jun 22, 2:53 pm, Ronbo <[email protected]> wrote: > > > > > > > OK - this is screwier than I realized. My description of the problem > > > > > > was wrong. It is not the parent id that was repeating for each link > > > > > > - > > > > > > it was the grand-parent (project/document) id. Then, when I tried > > > > > > with > > > > > > this_parent in the link, I get the innermost card's id, which I > > > > > > already have. So it seems I am either fetching one to high, or one > > > > > > to > > > > > > low in the hierarchy. > > > > > > > confused > > > > > > > On Jun 22, 4:29 pm, kevinpfromnm <[email protected]> wrote: > > > > > > > > this_parent I believe is the previous context item (in views, not > > > > > > > model). > > > > > > > > On Jun 22, 1:14 pm, Ronbo <[email protected]> wrote: > > > > > > > > > Thanks again - that clarifies a lot. One other question - what > > > > > > > > is the > > > > > > > > best way to access the id of the parent card? Is this info easy > > > > > > > > to get > > > > > > > > at? > > > > > > > > > On Jun 22, 3:11 pm, kevinpfromnm <[email protected]> wrote: > > > > > > > > > > Well, mostly it would encapsulate your backend logic in one > > > > > > > > > spot along > > > > > > > > > with an easy place to manage access. It doesn't have to be a > > > > > > > > > lifecycle since you really only have one step/state, but > > > > > > > > > think it > > > > > > > > > makes for a clean way to handle it. > > > > > > > > > > your create action would include params for item to copy and > > > > > > > > > target to > > > > > > > > > link to. You'd have to include the form and maybe tweak it a > > > > > > > > > little > > > > > > > > > to get the stuff that's automatic set as hidden inputs. > > > > > > > > > > On Jun 22, 12:53 pm, Ronbo <[email protected]> wrote: > > > > > > > > > > > Thanks Kevin - not sure what there is about a lifecycle > > > > > > > > > > that would be > > > > > > > > > > superior. Can you explain a bit? > > > > > > > > > > > On Jun 22, 2:07 pm, kevinpfromnm <[email protected]> > > > > > > > > > > wrote: > > > > > > > > > > > > I don't think it's going to be a routing issue for > > > > > > > > > > > this... I would > > > > > > > > > > > probably look at making a lifecycle to handle the copy > > > > > > > > > > > process and/or > > > > > > > > > > > you might need to add hidden variables in the form(s) to > > > > > > > > > > > specify > > > > > > > > > > > targets. > > > > > > > > > > > > On Jun 22, 7:36 am, Ronbo <[email protected]> wrote: > > > > > > > > > > > > > Looking at that post, I should add some details. > > > > > > > > > > > > > URLs look like: > > > > > > > > > > > > >http://localhost:3000/activities/3/duplicado/1-hiring-initiativehttp:... > > > > > > > > > > > > > instead of > > > > > > > > > > > > >http://localhost:3000/activities/3/duplicado/4-something-else, > > > > > > > > > > > > etc > > > > > > > > > > > > > Here is the route: > > > > > > > > > > > > > map.duplicado 'activities/:activity_id/duplicado/:id', > > > > > > > > > > > > :controller => > > > > > > > > > > > > 'activities', :action => 'duplicado', :has_many > > > > > > > > > > > > => :units#, :path_prefix => '/activities/:activity_id' > > > > > > > > > > > > > On Jun 21, 7:07 pm, Ronbo <[email protected]> > > > > > > > > > > > > wrote: > > > > > > > > > > > > > > Hi all, > > > > > > > > > > > > > > I have a scenario where users will create new > > > > > > > > > > > > > documents, documents > > > > > > > > > > > > > will have sections, and users can add boilerplate > > > > > > > > > > > > > content to each > > > > > > > > > > > > > section. Users will also be able to make a local > > > > > > > > > > > > > (editable) copy of > > > > > > > > > > > > > the pieces of content. > > > > > > > > > > > > > > I want to present this to the users as a single page, > > > > > > > > > > > > > with the > > > > > > > > > > > > > document, sections and pieces all available and > > > > > > > > > > > > > editable without a lot > > > > > > > > > > > > > of navigating. I do this by rendering the section > > > > > > > > > > > > > collection on the > > > > > > > > > > > > > project page, and the piece collection on each > > > > > > > > > > > > > section card. > > > > > > > > > > > > > > I have most of this working, but for creating a copy > > > > > > > > > > > > > of a piece of > > > > > > > > > > > > > content, I need to update the link table that joins > > > > > > > > > > > > > the piece of > > > > > > > > > > > > > content to the section. What I do is 1. create a copy > > > > > > > > > > > > > of the piece, > > > > > > > > > > > > > flag the copy as editable and then change the > > > > > > > > > > > > > piece_id on the join and > > > > > > > > > > > > > refresh the page. > > > > > > > > > > > > > > but ... the urls constructed for my "copy" link, > > > > > > > > > > > > > which includes the > > > > > > > > > > > > > piece_id, the action name and the section_id *all* > > > > > > > > > > > > > have the section id > > > > > > > > > > > > > for the first section on the page, regardless of > > > > > > > > > > > > > which section a piece > > > > > > > > > > > > > is in. So if I click "copy" on piece 4 in section 3, > > > > > > > > > > > > > the controller > > > > > > > > > > > > > tries to make a copy of piece 4 in section 1. > > > > > > > > > > > > > > Any ideas? > > > > > > > > > > > > > > Thanks,
-- 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.
