ruby>>
map.resources :users
map.resource :session
<<--

routes.rbに出てくる、map.resource。綴り間違い??とひそかに思っていたらちゃんとありました。
map.resourceについてヘルプを見てみます。

Creates named routes for implementing verb-oriented controllers for
a singleton resource. A singleton resource is global to the current user visiting the application, such as a user‘s /account profile.

単数コントローラ名でパスを提供する場合に使えるようです。

  • a singular name is given to map.resource. The default controller name is taken from the singular name.
  • To specify a custom plural name, use the :plural option. There is no :singular option
  • No default index, new, or create routes are created for the singleton resource controller.
  • When nesting singleton resources, only the singular name is used as the path prefix (example: 'account/messages/1')
  • 単数形を使ったリソースを提供できます
  • :pluralオプションを使えば、複数を使うこともOK。:singularオプションはありません。
  • index, new, createのroutesは作られません
  • 入れ子で単数形resourceを使っている場合、prefixには単数形が使われます
    ex 'account/messages/1'

ヘルプにある生成されるというパスと私の環境のrake routesで表示されるパスが異なるようなので使用しているrailsで確認することが必要があるように思います。

posted by satoko satoko on Wed 28 Nov 2007 at 06:23 with 0 comments
Contents rssrss
NSAssertやNSLogを無効にする:-DNS_BLOCK_ASSERTIONS=1とNS_BLOCK_ASSERTIONS
GDBでview.frameを表示させる
Core Animationについてのリンク集
[iPhone] new BSDライセンスについてライセンス引用のメモ
Implementing a Container View Controller in UIViewController Class Reference
UITableView用のNSIndexPathの作り方
Xcodeのテンプレート、View-based ApplicationとWindow-based Applicationの違い
CopyOnSelectのLion対応
Xcode4のCode Snippetsを別のPCに移動する+gitで管理する
[iPhone] Singleton: iOS4以降はGCDのdispatch_onceを使う
Tags
iphone開発gitIBInterfaceBuilderiOSSIMBLSnippetsterminaltwitterxcodeXcode4
Comments rssrss
guest guest: Muchos turistas buscan la mejor forma de llegar a ... 05/30 03:19
guest guest: San Antonio de Areco es conocido como la cuna de l... 05/27 19:47
guest guest: Optimizar el tiempo durante un viaje de negocios e... 05/18 00:46
guest guest: Para muchos turistas, el transporte publico y la l... 05/15 18:22
Services from s21g
MagicBag
MagicBagは、Cloudflare R2やS3互換ストレージをMacのFinderから扱えるファイル同期クライアントです。
アンテナショップめぐり
東京にある全国のアンテナショップ、イベント、特産品を地図や条件から探せるサービスです。
YOMU Web小説リーダー
YOMUは、Web小説の読み上げに特化したiPhoneアプリです。
補助探
公開されている補助金・助成金情報を集約し、条件に合う制度を探しやすくするサービスです。
jotter.me
jotter.meは、考えやアイデア、情報を書き留めるためのノートサービスです。