• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

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を作成する方法を紹介します。そのためには、次のような手順を踏みます。

  1. calendar_helper plugin. をインストール
  2. mv vendor/plugins/calendar_helper other_place
  3. ./script/generate controller calendar
  4. mv other_place/calendar_helper vendor/plugins
  5. vendor/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 Png genki on Fri 26 Jan 2007 at 07:12

Comments:

or Preview
Social Bookmarks
  • Delicious
  • B_entry105
  • Clip_16_12_w
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ