From lists at ruby-forum.com Thu Jun 5 15:55:00 2008 From: lists at ruby-forum.com (Alexey Petrushin) Date: Thu, 5 Jun 2008 21:55:00 +0200 Subject: [Nitro] Og and the 'Composite' pattern. Message-ID: <8dee38d0c2ea63f929e935429bcc7b13@ruby-forum.com> Hello, is there a way to implement the 'Composite' pattern in Og? Probably it should looks like this: class Item property :name, String belongs_to :parent, Item end class Container < Item has_many :items, Item end class Image < Item; end class Post < Item; end class Folder < Container; end But i failed to achieve this with Og :( P.S. Does ActiveRecords or DataMapper support this feature? Thanks! -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jun 5 16:03:46 2008 From: lists at ruby-forum.com (Alexey Petrushin) Date: Thu, 5 Jun 2008 22:03:46 +0200 Subject: [Nitro] Partially solution. In-Reply-To: <8dee38d0c2ea63f929e935429bcc7b13@ruby-forum.com> References: <8dee38d0c2ea63f929e935429bcc7b13@ruby-forum.com> Message-ID: <57f1377545fed3a8ff99877782a66047@ruby-forum.com> Partially solution. It's possible to implement subject this way: class Item property :name, String belongs_to :parent, Object end class Container < Item has_many :items, Item end class Folder < Item has_many :items, Item end But, there are major disadvantages: - Code duplication, each 'Container' should explicitly include 'has_many ...'. - Instead of 'Item' you forced to use 'Container::Item' and 'Folder::Item' and remember about it. - Instead of one 'Item' table you got two distinct 'container_item' and 'folder_item' tables. So, this is not the best solution ... :( -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Jun 5 19:28:50 2008 From: lists at ruby-forum.com (Alexey Petrushin) Date: Fri, 6 Jun 2008 01:28:50 +0200 Subject: [Nitro] Og and 'duck typing' search Message-ID: <850f422b6e6502ff49907872cbf9205c@ruby-forum.com> Can Og search for 'name' in all 'managed' classes? I.e. there are: Post, User, Topic, Comment, ..., and all of them have the 'name' property. So, can i use something like: Og.search_by_name('my_name')? Or i should explicitly do it for all classes? I.e.: Post.search_by_name('my_name'). concat(User.search_by_name('my_name')). concat ... -- Posted via http://www.ruby-forum.com/. From george.moschovitis at gmail.com Fri Jun 6 04:13:46 2008 From: george.moschovitis at gmail.com (George Moschovitis) Date: Fri, 6 Jun 2008 11:13:46 +0300 Subject: [Nitro] Og and 'duck typing' search In-Reply-To: <850f422b6e6502ff49907872cbf9205c@ruby-forum.com> References: <850f422b6e6502ff49907872cbf9205c@ruby-forum.com> Message-ID: No you should do it for all classes: User.find_by_name(name) Post.find_by_name(name) etc... -g. On Fri, Jun 6, 2008 at 2:28 AM, Alexey Petrushin wrote: > Can Og search for 'name' in all 'managed' classes? > > I.e. there are: Post, User, Topic, Comment, ..., and all of them have > the 'name' property. So, can i use something like: > > Og.search_by_name('my_name')? > > Or i should explicitly do it for all classes? I.e.: > > Post.search_by_name('my_name'). > concat(User.search_by_name('my_name')). > concat ... > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Nitro-general mailing list > Nitro-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/nitro-general > -- http://gmosx.me.gr http://joy.gr http://cull.gr http://nitroproject.org http://phidz.com http://joyerz.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From arne at arnebrasseur.net Sat Jun 7 05:39:21 2008 From: arne at arnebrasseur.net (Arne Brasseur) Date: Sat, 07 Jun 2008 11:39:21 +0200 Subject: [Nitro] Og and 'duck typing' search In-Reply-To: References: <850f422b6e6502ff49907872cbf9205c@ruby-forum.com> Message-ID: <484A5749.403@arnebrasseur.net> You should be able to do something like Og.managed_classes.map {|c| c.find_by_name(name)}.flatten A. George Moschovitis wrote: > No you should do it for all classes: > > User.find_by_name(name) > Post.find_by_name(name) > > etc... > > -g. > > On Fri, Jun 6, 2008 at 2:28 AM, Alexey Petrushin > wrote: > > Can Og search for 'name' in all 'managed' classes? > > I.e. there are: Post, User, Topic, Comment, ..., and all of them have > the 'name' property. So, can i use something like: > > Og.search_by_name('my_name')? > > Or i should explicitly do it for all classes? I.e.: > > Post.search_by_name('my_name'). > concat(User.search_by_name('my_name')). > concat ... > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Nitro-general mailing list > Nitro-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/nitro-general > > > > > -- > http://gmosx.me.gr > http://joy.gr > http://cull.gr > http://nitroproject.org > http://phidz.com > http://joyerz.com > ------------------------------------------------------------------------ > > _______________________________________________ > Nitro-general mailing list > Nitro-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/nitro-general -- Ein Fuchs mu? tun, was ein Fuchs tun mu? arne at arnebrasseur.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From william.full.moon at gmail.com Sat Jun 7 14:51:05 2008 From: william.full.moon at gmail.com (* William) Date: Sun, 8 Jun 2008 04:51:05 +1000 Subject: [Nitro] Partially solution. In-Reply-To: <57f1377545fed3a8ff99877782a66047@ruby-forum.com> References: <8dee38d0c2ea63f929e935429bcc7b13@ruby-forum.com> <57f1377545fed3a8ff99877782a66047@ruby-forum.com> Message-ID: <9e03c3c60806071151u4dfbeabfvb1e3bdee27aec3c2@mail.gmail.com> Thanks there Alexey I love this post! I have a design need for exactly thing like (both) 'Item' and 'Container'. As well, I'd like to make a "generic" 'Container' that cna accept 'Items" sub-clases too. I'd like though to do ... *class *Data_Table_stuff *property* subclass-of-Item *property* subclass-of-Container *end *# Data_Table_stuff I'll admit that I'm sitting back on this. My issuer -- Still some solid Og base is a precursor. :-) 2008/6/6 Alexey Petrushin : > Partially solution. It's possible to implement subject this way: > > class Item > property :name, String > belongs_to :parent, Object > end > > class Container < Item > has_many :items, Item > end > > class Folder < Item > has_many :items, Item > end > > But, there are major disadvantages: > - Code duplication, each 'Container' should explicitly include 'has_many > ...'. > - Instead of 'Item' you forced to use 'Container::Item' and > 'Folder::Item' and remember about it. > - Instead of one 'Item' table you got two distinct 'container_item' and > 'folder_item' tables. > > So, this is not the best solution ... :( > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Nitro-general mailing list > Nitro-general at rubyforge.org > http://rubyforge.org/mailman/listinfo/nitro-general > -- aloha, \_w_/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Sun Jun 29 00:37:09 2008 From: lists at ruby-forum.com (Alex Hawker) Date: Sun, 29 Jun 2008 06:37:09 +0200 Subject: [Nitro] Amazon S3 In-Reply-To: References: <389c43e40801070627n132d4af9r95e2b79069bd3980@mail.gmail.com> Message-ID: <2f9f34c4b2e47ce87495b915a38d3c35@ruby-forum.com> Agreed! I found a few good tutorials online as well. Maybe you'll find what you're looking for: http://www.newwebplatform.com/tips-and-tutorials/Amazon-S3 -- Posted via http://www.ruby-forum.com/.