On Monday, June 28, 2010, kevinpfromnm <[email protected]> wrote: > Oddly enough, I've run into a situation that needs a treelike data > structure just today. But I need a link table really so it's not > quite the same. If you can switch it off to a separate table the > infinite loop won't occur (as long as both parts aren't accessible of > course). > > Off topic slightly, does anyone know of a good tree (well, more > flowchart like) diagramming plugin for rails/html/jscript? > > Something that could put down a box for each element and lines to show > relationships but I realize that that is not an easy thing to do > (hence looking for a prebuilt solution :P) >
I swear I've seen a jQuery plugin for this, but I can't seem to find it again. If you just need a non-interactive visual, I know that Railroad has done some similar stuff for visualizing model associations, etc. --Matt Jones > On Jun 28, 2:32 pm, kevinpfromnm <[email protected]> wrote: >> Yes, that does it. I bet it's trying to reflect for each model >> subform to make a subform for that and etc. So, unless there's a >> quick way to add a recursion check to the multimodel form code, might >> have to roll your own solution for now. > >> On Jun 28, 2:26 pm, Warren Gavin <[email protected]> wrote: >> >> >> >> > So I see where I mistyped something. I do have : dependent >> > => :destroy but was copying some code and must have taken the >> > accessible code out. Would you try replacing: >> >> > has_many :owned_models, :dependent => :destroy, :order => :position >> >> > with >> >> > has_many :owned_models, :accessible => true, :dependent >> > => :destroy, :order => :position >> >> > I actually have this. Once you remove the :accessible => true it >> > works but you are unable to edit all in one page. Thoughts? >> >> > On Jun 28, 1:52 pm, kevinpfromnm <[email protected]> wrote: >> >> > > I just did a basic test and have no error though I had to >> > > change :dependent => true to :destroy. I did not make any custom view >> > > code, just basic model resource with these changes: >> >> > > fields do >> > > name :string >> > > timestamps >> > > end >> >> > > acts_as_list :scope => :owned_model >> >> > > belongs_to :owned_model >> > > has_many :owned_models, :dependent => :destroy, :order => :position >> >> > > and >> > > children :owned_models # in viewhint >> >> > > So there's no bug in hobo. Can you post the rest of your model code >> > > and the relevant view code? >> >> > > On Jun 28, 12:07 pm, Warren Gavin <[email protected]> wrote: >> >> > > > Based on the documentation I have seen I thought I was using >> > > > acts_as_list correctly. See link below. >> >> > > >http://github.com/rails/acts_as_list >> >> > > > I agree w/the recursion idea and I think its the view that is having >> > > > the problem. >> >> > > > Just to add some more details, the collection I want to work with is >> > > > essentially parent/child relationship that is simple and all I want to >> > > > do is have the ability to order the children. The root of any >> > > > collection of NewModel is one that has a nil for new_model_id. Not >> > > > sure if that clears up anything but thought I would add more details. >> >> > > > Thanks for the help. >> >> > > > On Jun 28, 11:59 am, kevinpfromnm <[email protected]> wrote: >> >> > > > > From the error I'd guess you've gotten some sort of recursion going >> > > > > in >> > > > > an infinite loop. I haven't done a lot with acts_as_list but should >> > > > > the scope be :new_model_id? >> >> > > > > On Jun 25, 9:18 am, Warren Gavin <[email protected]> wrote: >> >> > > > > > I am new to Hobo, and Rails for that matter, so please forgive my >> > > > > > noob >> > > > > > post. I believe I am not understanding how to implement a >> > > > > > belongs_to, >> > > > > > has_many and acts_as_list in a self join scenario. >> >> > > > > > I created a Hobo app, and added one hobo_model_resource named >> > > > > > NewModel. I modified app/models/new_model.rb to the following (the >> > > > > > self join and acts_as_list): >> >> > > > > > class NewModel < ActiveRecord::Base >> >> > > > > > hobo_model >> >> > > > > > fields do >> > > > > > name :string >> > > > > > new_model_id :integer >> > > > > > timestamps >> > > > > > end >> >> > > > > > acts_as_list :scope => :new_model >> >> > > > > > belongs_to :new_model >> > > > > > has_many :new_models, :dependent => true, :order => :position >> >> > > > > > ... >> >> > > > > > end >> >> > > > > > I also modified the app/viewhints/new_model.rb and added: >> >> > > > > > children :new_models >> >> > > > > > Generated my hobo_migration and all seemed good. >> >> > > > > > Then I start the server up just fine. Once I try to create a new >> > > > > > entry for NewModel I get a "stack level too deep". Generally >> > > > > > speaking >> > > > > > I believe I understand what is going on (at 40k feet). >> > > > > > Essentially we >> > > > > > have a self join scenario that Hobo can't display from an edit/new >> > > > > > perspective based on my setup. >> >> > > > > > What I would like to do is manage new_models like a tree >> > > > > > (acts_as_tree) and have tried adding this as well with the same >> > > > > > result. >> >> > > > > > Thoughts? Thanks in advance. > > -- > 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. > > -- 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.
