This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/160
簡単にカレンダーを表示できるcalendar_helperプラグインは大変便利ですが、これをインストールすると'CalendarHelper'という名前がRuby on Railsに予約されてしまうのをご存知でしょうか。
これはつまり、CalendarControllerを作るのが難しくなるということです。もしCalendarControllerの雛形をscript/generateコマンドで作成しようとしても、以下のようなメッセージが出力されて拒まれます。
The name 'CalendarHelper' is reserved by Ruby on Rails
この問題を回避してCalendarControllerを作成する方法を紹介します。そのためには、次のような手順を踏みます。
- calendar_helper plugin. をインストール
mv vendor/plugins/calendar_helper other_place./script/generate controller calendarmv other_place/calendar_helper vendor/pluginsvendor/plugins/calendar_helper/init.rbを編集
こんな感じに
require File.join(File.dirname(__FILE__), 'lib/calendar_helper')
[English]
This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/160
posted by
genki on Fri 26 Jan 2007 at 07:12 with 0 comments