平衡点
2006/08/06
_ n:n リレーションシップ
中間テーブルも弄りたい, とか思い始めたよ. habtm(has_and_belongs_to_many) でも行けるのかもしれないけど, has_many() + has_many(:through => ) で.
例として
- Paper には複数の Authors がいる(場合もある)
- Authors には順番が存在している
- Author は複数の Papers を持っている(…場合もある)
こんな時. 中間テーブルとして Priorities(名前が変だが) を作成してみる. Priorities は
def self.up create_table(:priorities) do |t| t.column(:author_id, :integer) t.column(:paper_id, :integer) t.column(:priority, :integer) end end def self.down drop_table(:priorities) end
みたいに作ってやる(migrate).
でもって model で
# app/models/paper.rb class Paper < ActiveRecord::Base has_many(:priorities, :order => :priority) has_many(:authors, :through => :priorities, :order => :priority) end
と
# app/models/author.rb class Author < ActiveRecord::Base has_many(:priorities, :order => :priority) has_many(:papers, :through => :priorities, :order => :priority) end
と
# app/models/priority.rb class Priority < ActiveRecord::Base belongs_to(:author) belongs_to(:paper) act_as_list(:scope => :paper_id) end
みたいな. これで複数の author に順番が作成された訳ですが. 正しく動くけど, もっと良い方法がありそうな気がする(実は中間テーブル不要, とか).
あとは登録の所でちょっとゴニョゴニョと. ToDo は dependent です.
[ツッコミを入れる]
2009/08/06
_ 帰神
帰神って書くとなんかカコイイ(違
先日のフロンティアセミナーに引き続き, 08/02-04 で札幌行ってきました.某開発ミーティングだったのですが, 「ちょっと 9 月からは無理じゃない?」という空気が流れつつあります.
ですがきっとなんとかするのでしょう. そんな訳で 08/12-15 にまた札幌に行きます.
涼しい北海道と暑い神戸を行ったり来たりするので, 体力ががががががが
(´・ω・`)
[ツッコミを入れる]
2010/08/06
_ squeeze is frozen !!!
debian-devel-announce に先程流れました.
Current status ============== As mentioned in the previous mail, we would freeze when various transitions are completed or being handled. We now feel that this stage has been reached. This means that we have stopped the automatic migration of packages from unstable to testing. . In other words, Squeeze has frozen. Thanks are due to everyone who has helped get us to this point. . Perhaps that's too subtle: _==_ _ _,(",)|_| *** Frosty says Squeeze is FROZEN. *** \/. \-| (He's in Austrailia, as it's winter there - __( : )|___ that's what the shovel is for, sandcastles)
BUG 報告したまんま直されていなくて気になるパッケージは幾つかあるんですが...
debian-annaounce にも流れました.
-------------------------------------------------------------------- The Debian Project http://www.debian.org/ Debian 6.0 "Squeeze" frozen press@debian.org August 6th, 2010 http://www.debian.org/News/2010/20100806 -------------------------------------------------------------------- . In this very moment, during the ongoing annual Debian Developer Conference "Debconf10" in New York, Debian's release managers have announced a major step in the development cycle of the upcoming stable release Debian 6.0 "Squeeze": . Debian "Squeeze" has now been frozen. . In consequence this means that no more new features will be added and all work will now be concentrated on polishing Debian "Squeeze" to achieve the quality Debian stable releases are known for. . The upcoming release will use Linux 2.6.32 as its default kernel in the installer and on all Linux architectures. . New features of the upcoming release include: * State of the art desktop environments, based on KDE 4.4.5, Gnome 2.30.0, LXDE 0.5.0, XFCE 4.6.2, X.org 7.5, OpenOffice.org 3.2.1 and many other applications. * Stable and current versions of common server software such as Apache 2.2.16, PHP 5.3.2, MySQL 5.1.48, PostgreSQL 8.4.4 and Samba 3.4. * Modern interpreters and compilers for all common languages such as Python 2.6 and 3.1, Perl 5.10, GHC 6.12 and GCC 4.4. * DKMS, a framework to generate Linux kernel modules whose sources do not reside in the Linux kernel source tree. * Dependency-based ordering of init scripts using insserv, allowing parallel execution to shorten the time needed to boot the system.
pTeXLive 間に合いませんでした(´・ω・`).
[ツッコミを入れる]