タグ

2009年2月6日のブックマーク (2件)

  • merbメモ| Sequelプラグインの書き方

    これからfooプラグインをつくるとする。fooプラグインはSequel::Modelのインスタンスメソッドにbar、クラスメソッドにbazを追加するってことにする。datasetにもメソッドを追加できるけど、流れはだいたい同じなので割愛。 ファイル名はsequel_foo.rbにして、パスの通ってる場所へ置く。 Sequelが決め打ちでrequireするから。gem化してしまえば解決するけど、ちょっと使うだけのときにgem化するのはやりすぎな感じがする。 ので、config/init.rbに、 Merb.push_path(:lib,Merb.root / "lib") と書いて、MERB_ROOT/lib/にsequel_foo.rbを置くことにした。でもこれだとMigrationのときになぜかエラーが出るので、ちゃんとやるにはやっぱりgem化するなりパス通すなりしたほうがいいと思う

  • Hackety Hack: the Coder's Starter Kit

    Hey, Wow, Real Kids are Learning! Our 8th grader reporting in: did Lesson Four in about 10 minutes but kept hacking for another 20 minutes. Today, video games lost the battle with Ruby. Unprecedented! YOUR FIRST PROGRAM One of Hackety Hack's sincere pledges is to make the most common code very easy and short. Downloading an MP3 should be one line of code. A blog should be very few. For example, ou