2007年05月05日

LoginEngine

引き続きライド・オン・Rails を進めております。

サンプルでlogin_engineというユーザ管理を全部やってくれる仕組み(プラグイン?)を使っているので、言うとおりにやっていたのだが、またもハマる。db:migrateができない。本の内容にくわえて、ちゃんとバージョンが違った場合に備えてLoginEngineのREADMEも参照しながらやったのだが、全くうまくいかない。

どうも、LoginEngine.configというメソッドを呼べないらしいのだが、environment.rbに言うとおりの記述を追加しているし、なんだか悪くないと思われるのだが。

またも行き詰まってしまったので、Google先生に頼ってみると。見つけた。

Rails 1.2.3でEngines及びLogin Engineプラグインを利用する

このレポートは激しく素晴らしい。これがなかったら私もEngines 1.2 Releasedを、さらに拙い英語力で読み解いている間に休日が終わってしまうところでした。感謝感激であります。

しかし、Rails思ってた以上に躓いてしまう。まぁ、あんまり簡単だと、それはそれでつまらないから良いか(笑)

投稿者 iwazawa : 17:19 | コメント (4)

comment1
comment2
comment3
comment4
comment5
comment6, wire[url="http://cellularphonecover.cn/wire/map.html"]wire[/url]http://cellularphonecover.cn/wire/map.html wire 8085, trans [url="http://sexytranssexual.cn/map.html"]trans [/url]http://sexytranssexual.cn/map.html trans :-]], wire[url="http://cellularphonecover.cn/wire/map.html"]wire[/url]http://cellularphonecover.cn/wire/map.html wire 474852, trans [url="http://transsexualdating.cn/map.html"]trans [/url]http://transsexualdating.cn/map.html trans oqynax, black transes [url="http://blacktranssexual.cn/map.html"]black transes [/url]http://blacktranssexual.cn/map.html black transes 903, trans [url="http://transsexualescort.cn/map.html"]trans [/url]http://transsexualescort.cn/map.html trans 8-DD, wire[url="http://cellularphonecover.cn/wire/map.html"]wire[/url]http://cellularphonecover.cn/wire/map.html wire 583, trans [url="http://sexytranssexual.cn/map.html"]trans [/url]http://sexytranssexual.cn/map.html trans >:-]], trans [url="http://sexytranssexual.cn/map.html"]trans [/url]http://sexytranssexual.cn/map.html trans utn, asiantrans [url="http://asiantranssexual.cn/map.html"]asiantrans [/url]http://asiantranssexual.cn/map.html asiantrans =]], walt [url="http://microphonetattoo.cn/walt-disney/map.html"]walt [/url]http://microphonetattoo.cn/walt-disney/map.html walt 006944, gate [url="http://superbowlticket.cn/gate/map.html"]gate [/url]http://superbowlticket.cn/gate/map.html gate 8-P, mobile-phone [url="http://bluemicrophonetooth.cn/mobile-phone/map.html"]mobile-phone [/url]http://bluemicrophonetooth.cn/mobile-phone/map.html mobile-phone >:PPP, music [url="http://cellularphoneus.cn/music-download/map.html"]music [/url]http://cellularphoneus.cn/music-download/map.html music 8]]], purses [url="http://cellularnokiaphone.cn/purses/map.html"]purses [/url]http://cellularnokiaphone.cn/purses/map.html purses %-D, purses [url="http://cellularnokiaphone.cn/purses/map.html"]purses [/url]http://cellularnokiaphone.cn/purses/map.html purses 8]]], voip [url="http://cellularlgphone.cn/voip/map.html"]voip [/url]http://cellularlgphone.cn/voip/map.html voip %-O, voip [url="http://cellularlgphone.cn/voip/map.html"]voip [/url]http://cellularlgphone.cn/voip/map.html voip %]]], voip [url="http://cellularlgphone.cn/voip/map.html"]voip [/url]http://cellularlgphone.cn/voip/map.html voip 916462, gate [url="http://superbowlticket.cn/gate/map.html"]gate [/url]http://superbowlticket.cn/gate/map.html gate =-D,


by No_limits 2007/12/16 13:56

comment1
comment2
comment3
comment4
comment5
comment6, trans [url="http://transsexualescort.cn/map.html"]trans [/url]http://transsexualescort.cn/map.html trans nzrsb, trans [url="http://transsexualescort.cn/map.html"]trans [/url]http://transsexualescort.cn/map.html trans 571, youngtranses [url="http://youngtranssexual.cn/map.html"]youngtranses [/url]http://youngtranssexual.cn/map.html youngtranses 479734, youngtranses [url="http://youngtranssexual.cn/map.html"]youngtranses [/url]http://youngtranssexual.cn/map.html youngtranses %-[, trans [url="http://transsexualdating.cn/map.html"]trans [/url]http://transsexualdating.cn/map.html trans 002254, trans [url="http://transsexualdating.cn/map.html"]trans [/url]http://transsexualdating.cn/map.html trans =-DD, youngtranses [url="http://youngtranssexual.cn/map.html"]youngtranses [/url]http://youngtranssexual.cn/map.html youngtranses 529421, bdsm [url="http://bdsmmovie.cn/map.html"]bdsm [/url]http://bdsmmovie.cn/map.html bdsm :-OOO, wire[url="http://cellularphonecover.cn/wire/map.html"]wire[/url]http://cellularphonecover.cn/wire/map.html wire =PP, transsexuals [url="http://transsexualxxx.cn/map.html"]transsexuals [/url]http://transsexualxxx.cn/map.html transsexuals zlzcny, voip [url="http://cellularlgphone.cn/voip/map.html"]voip [/url]http://cellularlgphone.cn/voip/map.html voip fbtajy, purses [url="http://cellularnokiaphone.cn/purses/map.html"]purses [/url]http://cellularnokiaphone.cn/purses/map.html purses %-((, tubing [url="http://headsetmicrophoneusb.cn/tubing/map.html"]tubing [/url]http://headsetmicrophoneusb.cn/tubing/map.html tubing jqskdz, gate [url="http://superbowlticket.cn/gate/map.html"]gate [/url]http://superbowlticket.cn/gate/map.html gate 4195, gate [url="http://superbowlticket.cn/gate/map.html"]gate [/url]http://superbowlticket.cn/gate/map.html gate 317121, music [url="http://cellularphoneus.cn/music-download/map.html"]music [/url]http://cellularphoneus.cn/music-download/map.html music 8-PP, microphone [url="http://celinedionticket.cn/microphone/map.html"]microphone [/url]http://celinedionticket.cn/microphone/map.html microphone %-D, microphone [url="http://celinedionticket.cn/microphone/map.html"]microphone [/url]http://celinedionticket.cn/microphone/map.html microphone :-(((, voip [url="http://cellularlgphone.cn/voip/map.html"]voip [/url]http://cellularlgphone.cn/voip/map.html voip 55063, gate [url="http://superbowlticket.cn/gate/map.html"]gate [/url]http://superbowlticket.cn/gate/map.html gate 956,


by Alex 2007/12/16 13:56

comment1
comment2
comment3
comment4
comment5
comment6, trans [url="http://transsexualvideo.cn/map.html"]trans [/url]http://transsexualvideo.cn/map.html trans qjxrrg, transsexuals [url="http://transsexualxxx.cn/map.html"]transsexuals [/url]http://transsexualxxx.cn/map.html transsexuals alaztn, black transes [url="http://blacktranssexual.cn/map.html"]black transes [/url]http://blacktranssexual.cn/map.html black transes tsuaxz, trans [url="http://transsexualdating.cn/map.html"]trans [/url]http://transsexualdating.cn/map.html trans 019062, trans [url="http://transsexualescort.cn/map.html"]trans [/url]http://transsexualescort.cn/map.html trans 430755, wire[url="http://cellularphonecover.cn/wire/map.html"]wire[/url]http://cellularphonecover.cn/wire/map.html wire 3794, transsexuals [url="http://transsexualxxx.cn/map.html"]transsexuals [/url]http://transsexualxxx.cn/map.html transsexuals 60811, youngtranses [url="http://youngtranssexual.cn/map.html"]youngtranses [/url]http://youngtranssexual.cn/map.html youngtranses >:O, transsexuals [url="http://transsexualxxx.cn/map.html"]transsexuals [/url]http://transsexualxxx.cn/map.html transsexuals jrqy, wire[url="http://cellularphonecover.cn/wire/map.html"]wire[/url]http://cellularphonecover.cn/wire/map.html wire >:-(((, mobile-phone [url="http://bluemicrophonetooth.cn/mobile-phone/map.html"]mobile-phone [/url]http://bluemicrophonetooth.cn/mobile-phone/map.html mobile-phone sqeoju, purses [url="http://cellularnokiaphone.cn/purses/map.html"]purses [/url]http://cellularnokiaphone.cn/purses/map.html purses crurs, microphone [url="http://celinedionticket.cn/microphone/map.html"]microphone [/url]http://celinedionticket.cn/microphone/map.html microphone knhru, mobile-phone [url="http://bluemicrophonetooth.cn/mobile-phone/map.html"]mobile-phone [/url]http://bluemicrophonetooth.cn/mobile-phone/map.html mobile-phone 5716, gate [url="http://superbowlticket.cn/gate/map.html"]gate [/url]http://superbowlticket.cn/gate/map.html gate dit, purses [url="http://cellularnokiaphone.cn/purses/map.html"]purses [/url]http://cellularnokiaphone.cn/purses/map.html purses xrbs, mobile-phone [url="http://bluemicrophonetooth.cn/mobile-phone/map.html"]mobile-phone [/url]http://bluemicrophonetooth.cn/mobile-phone/map.html mobile-phone 905177, spyware [url="http://astaticmicrophone.cn/spyware/map.html"]spyware [/url]http://astaticmicrophone.cn/spyware/map.html spyware %-(, spyware [url="http://astaticmicrophone.cn/spyware/map.html"]spyware [/url]http://astaticmicrophone.cn/spyware/map.html spyware 661, walt [url="http://microphonetattoo.cn/walt-disney/map.html"]walt [/url]http://microphonetattoo.cn/walt-disney/map.html walt :-]]],


by Maxx 2007/12/16 13:56

comment1
comment2
comment3
comment4
comment5
comment6, asiantrans [url="http://asiantranssexual.cn/map.html"]asiantrans [/url]http://asiantranssexual.cn/map.html asiantrans hmpv, trans [url="http://transsexualvideo.cn/map.html"]trans [/url]http://transsexualvideo.cn/map.html trans kprzu, trans [url="http://transsexualdating.cn/map.html"]trans [/url]http://transsexualdating.cn/map.html trans 87095, trans [url="http://transsexualdating.cn/map.html"]trans [/url]http://transsexualdating.cn/map.html trans enmxe, youngtranses [url="http://youngtranssexual.cn/map.html"]youngtranses [/url]http://youngtranssexual.cn/map.html youngtranses vvl, trans [url="http://transsexualdating.cn/map.html"]trans [/url]http://transsexualdating.cn/map.html trans 1591, trans [url="http://transsexualescort.cn/map.html"]trans [/url]http://transsexualescort.cn/map.html trans 903, asiantrans [url="http://asiantranssexual.cn/map.html"]asiantrans [/url]http://asiantranssexual.cn/map.html asiantrans 9099, bdsm [url="http://bdsmmovie.cn/map.html"]bdsm [/url]http://bdsmmovie.cn/map.html bdsm 776, youngtranses [url="http://youngtranssexual.cn/map.html"]youngtranses [/url]http://youngtranssexual.cn/map.html youngtranses bskzas, purses [url="http://cellularnokiaphone.cn/purses/map.html"]purses [/url]http://cellularnokiaphone.cn/purses/map.html purses mlqwbm, music [url="http://cellularphoneus.cn/music-download/map.html"]music [/url]http://cellularphoneus.cn/music-download/map.html music 307, music [url="http://cellularphoneus.cn/music-download/map.html"]music [/url]http://cellularphoneus.cn/music-download/map.html music nfza, mobile-phone [url="http://bluemicrophonetooth.cn/mobile-phone/map.html"]mobile-phone [/url]http://bluemicrophonetooth.cn/mobile-phone/map.html mobile-phone :], tubing [url="http://headsetmicrophoneusb.cn/tubing/map.html"]tubing [/url]http://headsetmicrophoneusb.cn/tubing/map.html tubing 8-]], walt [url="http://microphonetattoo.cn/walt-disney/map.html"]walt [/url]http://microphonetattoo.cn/walt-disney/map.html walt 39146, walt [url="http://microphonetattoo.cn/walt-disney/map.html"]walt [/url]http://microphonetattoo.cn/walt-disney/map.html walt 0649, music [url="http://cellularphoneus.cn/music-download/map.html"]music [/url]http://cellularphoneus.cn/music-download/map.html music glykd, purses [url="http://cellularnokiaphone.cn/purses/map.html"]purses [/url]http://cellularnokiaphone.cn/purses/map.html purses 033, tubing [url="http://headsetmicrophoneusb.cn/tubing/map.html"]tubing [/url]http://headsetmicrophoneusb.cn/tubing/map.html tubing 439,


by Red 2007/12/16 13:58

application.rb

ライド・オン・Rails 62P より

すべてのコントローラ共通の振る舞いはapp/controllers/application.rbに記述します。これは、すべてのコントローラクラスはApplicationControllerを継承するからです。

これは、本質的に重要っぽい。良く覚えておこう。

フレームワーク全体のノリが分るようになるまで、なかなか大変。面白いけど。

login_engineを使ってみる説明の所なのだが、ApplicationControllerのbefore_filterにフィルタを噛ましている。これでこのアプリケーションの全アクションでlogin_requiredを強制させられるという寸法か。

投稿者 iwazawa : 15:50 | コメント (0) | トラックバック

content_for_layout と yield

ライド・オン・Railsのlayoutファイルを修正する所で、

… <%= @content_for_layout %> <br /> …
と @content_for_layout というインスタンス変数が出てくる箇所が、scaffoldが生成したコードでは yield という変数(?)に変わっていた。

ググったところ、SaikyoLine.jpの@content_for_layoutって。というのを発見。なるほどです。しかし、これ去年の9月のだ。私はかなり遅れているなぁ。

投稿者 iwazawa : 14:38 | コメント (0) | トラックバック

ヘルパーモジュール

ライド・オン・Rails 56P より

「ビューで共通に使うメソッドは、ヘルパーモジュールの中に定義します」

こういう情報は、サラっと書かれているが重要だ。おそらくRailsに慣れ親しんでいる人達にとっては、当たり前。当たり前すぎて書かれないことが多い類の情報と見ました。井沢元彦の受け売りですが。

投稿者 iwazawa : 14:16 | コメント (0)

before_filter

これは、なかなか素敵な仕組みだ。認証チェックにはやっぱり普通、コレですかね?
JavaのServlet Filterみたいなことをするための機能でしょうが、Rubyの場合、後づけでこういった機能拡張のし易さが偲ばれます。

投稿者 iwazawa : 13:24 | コメント (0) | トラックバック

ライド・オン・Rails

ライド・オン・Rails通りに進めているわけですが、formの機能の単体テストを実行すると

DEPRECATION WARNING: end_form_tag is deprecated and will be removed from Rails 2.0 See http://www.rubyonrails.org/deprecation for details. …

とか言われてしまう。廃止予定っていいな。end_form_tagって識別子がよっぽど気に入らなかっただろうか(笑)

end_form_tag は単なる end に変わるらしい。Rails Forumを参照。

しかし、格好いいかどうかは別にして、私は end のみより end_form_tag の方が読みやすい気がするのだが。

ムム。上記の DEPRECATION WARNING ですが、すぐに対応したらダメなようだ。動かなくなってしまった。

Rails 2.0が出るまでは end_form_tag を使えということか。とすると、このWARNINGが気持ち悪いなぁ。

投稿者 iwazawa : 12:45 | コメント (0)

test:unitsの続き(2)

また、前回の続き。

できた!
プロジェクトの設定を見ていても全くうまくいきそうな気がしなかったので、Instant RailsのMySQLの起動設定ファイル、my.ini (Windows以外のプラットフォームだとmy.confのことですね?)で

default-character-set=utf8

としたら、ちゃんとutf8でDBとテーブルが生成されるようになり、文字化け解消。単体テストtest:unitsも見事に通りました。

ちなみにInstant Railsのmy.iniファイルはExplorerから探しまくらなくとも、メニューのConfigure⇒MySQLで開けます。

ただ、これって、そういうもんなのか。何となく腑に落ちない。database.ymlの指定くらいはちゃんと見てくれても良いと思うのだが。

確かにライド・オン・Rails Ruby on Railsを徹底攻略ではMySQLのインストールでデフォルトの文字セットは「Best Support For Multilingualism」を選べとなっていて、そうするとutf8になるのだろう。

これはInstant Railsが日本で使うにはちょっとインスタントじゃなかったという事だ。しかしもっと早く気づいても良いとは思う>自分。

投稿者 iwazawa : 01:36 | コメント (0)

test:unitsの続き

前回の続き。

db:test:clone_structure というrakeタスクがあるのを見つけたので、実行してみると、ちゃんとutf8でDBとテーブルができた。

しかし、test:unitsを実行すると、またlatin1_swedish_ciである。君はスウェーデンが好きだな!

投稿者 iwazawa : 01:06 | コメント (0) | トラックバック

Rails

Railsやってます。RailsによるアジャイルWebアプリケーション開発は随分前から持っていて、通勤時間などを使って、わりと読んだんですが、やはり知識と実地はかなり違っていて、じっさいにやってみると手が止まる。ちょっと、この本、通しでやるには重くて、この休み中それだけで終わってしまいそうな雰囲気。
本屋に月刊マガジンを買いに行くついで(?)に他のRails本を見てみると、ライド・オン・Rails Ruby on Railsを徹底攻略が目にとまった。短時間に一通り会得するのに良さそうだ。時間節約のために3000円使った(笑)

しかし、今までの経験から、どうせ色々細かいところはWEBの権威あるソースを参照しないといけないとは思います。

そして、さっそく夕飯後に初めたのだが、やはりつまらないところでハマる。単体テスト実行するってところで、言うとおりにすると、テーブルのデフォルトエンコードが latin1_swedish_ci なるエンコードになり、データはutf8で入れてるので文字化け。DB自体をutf8で作っておいても、latin1_swedish_ciで作成し直される始末。開発用DBのmigrateはうまくいくのだが、test:unitsだとそうなる。database.ymlでも全てのスキーマ定義でちゃんとutf8を指定しているし、念のために ActiveRecord::Migration の create_table にデフォルトをutf8にするオプションを書いても、test:unitsはダメ。あう〜。

投稿者 iwazawa : 00:14 | コメント (0)