DataMapperでsetterをオーバライドする方法
DataMapper
1 def uri=(uri) 2 attribute_set :uri, ::URI.parse(uri).normalize.to_s 3 end
DataMapper
1 def uri=(uri) 2 attribute_set :uri, ::URI.parse(uri).normalize.to_s 3 end
度々忘れるのでメモしておきます。
1 Merb::ControllerExceptions .constants.sort #=> ["Accepted", "ActionNotF ound", "BadGateway ", "BadRequest ", "Base", "ClientErro r", "Conflict", "Continue", "Created", "Expectatio nFailed", "Forbidden", "GatewayTim eout", "Gone", "HTTPVersio nNotSuppor ted", "Informatio nal", "InternalSe rverError", "LayoutNotF ound", "LengthRequ ired", "MethodNotA llowed", "MovedPerma nently", "MovedTempo rarily", "MultiPartP arseError", "MultipleCh oices", "NoContent", "NonAuthori tativeInfo rmation", "NotAccepta ble", "NotFound", "NotImpleme nted", "NotModifie d", "OK", "PartialCon tent", "PaymentReq uired", "Preconditi onFailed", "ProxyAuthe nticationR equired", "Redirectio n", "RequestEnt ityTooLarg e", "RequestRan geNotSatis fiable", "RequestTim eout", "RequestURI TooLarge", "ResetConte nt", "STATUS_COD ES", "SeeOther", "ServerErro r", "ServiceUna vailable", "Successful ", "SwitchingP rotocols", "TemplateNo tFound", "TemporaryR edirect", "Unauthoriz ed", "Unsupporte dMediaType ", "UseProxy"]
Merb/DataM
1 config.before(:all) do 2 DataMapper::AutoMigrat or.auto_migra te(nil, 3 *(DataMapper ::Resource.descendant s - [Merb::DataMapper SessionSto re])) 4 end
セッションストアを使っている場合は、
Merb::Data
DataMapper
1 self.auto_migrate!(repository _name = nil) 2 AutoMigrat or.auto_migra te(repository _name) 3 end
AutoMigrat
1 def self.auto_migrate(repository _name = nil, *descendant s) 2 auto_migra te_down(repository _name, *descendant s) 3 auto_migra te_up(repository _name, *descendant s) 4 end
第二引数以降でDMのクラスリストを指定できる。
省略すると、DataMapper
今週末の4/5(日)にMerbJogを開催いたします。 Merb/Rubyなど、プログラミングに関する会話をしながら皇居の周りを走ります。 詳細・参加登録は以下のページをご覧ください。
開催時刻は多少変動する可能性があります。 雨天、悪天候の場合は延期となります。 ご了承ください。
急遽大門駅付近で開催されることになったCouchDB勉強会のレポートです。
参加者: @maiha, @yugui, @yamaz, @takiuchi
そもそもCouchDBは何かというと、 Apacheのプロジェクト で、分散、耐障害性、スキーマフリー、ドキュメント指向なデータベスで、 RESTfulなAPIを使って制御します。
結構前から存在していたのですが、取りかかるきっかけがなくてスルーしていました。
しかし、dm-couchdb
早速、couchdbをインストールします。
いまのところ、ソースからcouchdb-0.
dm-couchdb
1 % cd adapters/dm-couchdb- adapter 2 % sudo rake install
すればOKです。 基本的な使い方は上記GitHubリポジトリのREADMEを読めば分かります。
結論として、普通にMerbアプリを作れるようになりました。
試しに作りかけの社内ツール的なものをMerb/DM/Co
Future Worksとしては、
などがありますね。
ubuntuにcouchdbをソースから入れる手順をメモしておきます。
データベースのメンテナンスのために、明日(2009/4/3)の早朝04:30ごろから30分程度、弊社のサービスに繋がりにくくなる時間が発生する見込みです。
ご迷惑をおかけいたしますが、よろしくお願いいたします。
Update
メンテナンスは無事に終了いたしました。
いろいろあって、いまはこんな感じになってます。
1 [alias] 2 co = checkout 3 ci = commit -a 4 st = status 5 up = pull --rebase 6 a = add 7 b = branch 8 c = commit 9 d = diff