タグ

ブックマーク / merblog.tt25.org (2)

  • merbメモ| Sequelでアソシエーションをつかう

    Sequelではhas_manyとかbelongs_toはエイリアスで、実際にはone_to_many,many_to_one,many_to_manyの3つのメソッドだけが存在します。has_one相当はありません。 関係の定義 だいたいこんな感じ。 class Article < Sequel::Model has_many :comments #複数のコメントを持つので複数形 belongs_to :category #ひとつのカテゴリに所属するので単数形 many_to_many :tags #複数のタグとくっつくので複数形 end class Comment < Sequel::Model belongs_to :article end class Category < Sequel::Model has_many :articles end class Tag < Sequ

  • merbメモ| Sequel作者のインタビュー和訳

    http://on-ruby.blogspot.com/2008/01/sequel-interview-with-sharon-rosner.html インタビューは2008年1月と9ヶ月近く前に行われたものですが、発見したのはさっきです。せっかくなので訳してみます。 既に多くのORMがあるのに、新しく書こうと思ったのはなぜですか?(There are already several ORMs out there. Why write another one?) Sharon: I wrote Sequel mainly because I tried ActiveRecord and it really didn’t fit what I wanted to do. The first thing that frustrated me was the lack of support

  • 1