Article View: pl.comp.lang.ruby
Article #1201Re: ActiveRecord + drzewo
From: Wojtek Piekutowski
Date: Fri, 20 Feb 2009 10:29
Date: Fri, 20 Feb 2009 10:29
25 lines
2401 bytes
2401 bytes
On Feb 18, 10:33 am, Maciej Biłas <mac...@inszy.org> wrote: > On Feb 17, 7:11 pm, Zbyszek Malec <zbysze...@tlen.pl> wrote: > > > Dnia Tue, 17 Feb 2009 04:45:11 -0800 (PST), Wojciech Piekutowski > > napisał(a): > > > > Jednak twoja definicja klasy Category jest nie do końca ok. Musisz > > > powiedziec jakiej kolumny ma użyć has_many, ponieważ domyślnie jest to > > > 'category_id'. > > > class Category < ActiveRecord::Base > > > belongs_to :parent_category, :class_name => 'Category' > > > has_many :subcategories, :class_name => 'Category', :foreign_key > > > => 'parent_category_id' > > > end > > > Rzeczywiście, przyczyną był błąd w definicji kategorii. Dzięki za pomoc. > > A w ogóle czy nie lepiej skorzystać tutaj z acts_as_nested_set? > > m. acts_as_tree będzie bardziej pasować do tego przypadku. Pozdrawiam, Wojciech Piekutowski
Technical Details
Message-ID:
<01a70da2-b855-4569-8452-0cbc76ccea0d@t3g2000yqa.googlegroups.com>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!lublin.pl!uw.edu.pl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!feeder.news-service.com!postnews.google.com!t3g2000yqa.googlegroups.com!not-for-mailReferences:
<6c73d4b9-ccf5-44be-a258-5cc7b94f6ced@j1g2000yqi.googlegroups.com> <1e07f68b-8294-40a1-b4d8-3b4cb14b185f@m42g2000yqb.googlegroups.com> <m1wkz7hjz0vu.bebfdg63ubqp$.dlg@40tude.net> <6386c9ff-8fdf-4fa5-b699-88aba9cc20c9@j35g2000yqh.googlegroups.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!lublin.pl!uw.edu.pl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!feeder.news-service.com!postnews.google.com!t3g2000yqa.googlegroups.com!not-for-mail From: Wojtek Piekutowski <w.piekutowski@gmail.com> Newsgroups: pl.comp.lang.ruby Subject: Re: ActiveRecord + drzewo Date: Fri, 20 Feb 2009 02:29:57 -0800 (PST) Organization: http://groups.google.com Lines: 28 Message-ID: <01a70da2-b855-4569-8452-0cbc76ccea0d@t3g2000yqa.googlegroups.com> References: <6c73d4b9-ccf5-44be-a258-5cc7b94f6ced@j1g2000yqi.googlegroups.com> <1e07f68b-8294-40a1-b4d8-3b4cb14b185f@m42g2000yqb.googlegroups.com> <m1wkz7hjz0vu.bebfdg63ubqp$.dlg@40tude.net> <6386c9ff-8fdf-4fa5-b699-88aba9cc20c9@j35g2000yqh.googlegroups.com> NNTP-Posting-Host: 85.202.52.191 Mime-Version: 1.0 X-Trace: posting.google.com 1235125797 15034 127.0.0.1 (20 Feb 2009 10:29:57 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 20 Feb 2009 10:29:57 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: t3g2000yqa.googlegroups.com; posting-host=85.202.52.191; posting-account=Q2pglAoAAAAVAvWFei12zfeIQg8qCJNr User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.6) Gecko/2009020911 Ubuntu/8.10 (intrepid) Firefox/3.0.6,gzip(gfe),gzip(gfe) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit