El 02/08/12 18:14, Matt Jones escribió:
On Aug 2, 2012, at 7:03 PM, Quiliro Ordóñez wrote:

How about this?:

class Work < ActiveRecord::Base

  hobo_model # Don't put anything above this

  fields do
    name :string
    url  :string
    timestamps
  end

  belongs_to :user
  has_many :works
  belongs_to :work
Looks reasonable - this is pretty much what acts_as_tree will build:

https://github.com/amerine/acts_as_tree/blob/master/lib/acts_as_tree.rb

Mostly what you get with the plugin are a few helper methods / scopes and a 
hint to future devs that this is really a tree and not some other weird thing. 
:)

Thank you Matt.

I have a 1 to 1 relation of a Work to another Work with the structure I described below. I would like a relation of many works to one work.

I have no idea how to use

acts_as_tree

in this case. It seems this would be a relation like this:

work 123
       \- work 124
        - work 125
        - work 126
work 126
       \- work 124
        - work 127
 etc.

--
Saludos libres,

Quiliro Ordóñez
Presidente
Asociación de Software Libre del Ecuador - ASLE
Av de la Prensa N58-219 y Cristóbal Vaca de Castro
Quito, Ecuador
(593)2-253 5534
(593)2-340 1517
(593)8-454 8078

--
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.

Reply via email to