- 追加された行はこの色です。
- 削除された行はこの色です。
* Ruby On Rails - tips [#qdb4a77c]
* Ruby On Rails - Tips [#rd4f9cfe]
** Annotate Models Plugin [#zfdfb48f]
- インストール
script/plugin install http://svn.pragprog.com/Public/plugins/annotate_models
** ディレクトリ構成 [#zd8cb99c]
, ディレクトリ名 , 目的
,app,プログラムを配置
,app/controllers,コントローラを配置
,app/controllers/application.rb,アプリケーション共通のフィルタ処理等
,app/controllers/xxx.rb,コントローラ毎に1ファイル。アクションはファイル内の1メソッド
,app/helpers,ヘルパー:コントローラで共通で使うメソッドを定義
,app/helpers/application_helper.rb,アプリケーション全体で使うものを配置
,app/helpers/xxxx_helper.rb,コントローラ毎にも定義できる
,app/models,モデル(含ORMのオブジェクト)を配置、Validateの処理もここに書く
,app/views,ビュー(rhtml)を配置、1コントローラに1ディレクトリ、1アクション1ファイル
,components,コンポーネントを配置
,config,設定ファイルを格納
,db,データベース関係のファイルを配置
,doc,ドキュメントを配置
,lib,ライブラリを配置
,log,ログファイルを格納
,public,Webサーバに対するドキュメントルート
,script,スクリプトファイルを格納
,test,テスト用のファイルを配置
,tmp,テンポラリファイルを格納
,vendor,プラグインファイルを配置
- 使い方
rake annotate_models
~
これでapp/models以下のファイルに下記のようなコメントをDBから抽出してつけてくれます.
# Schema as of Mon Feb 27 00:55:58 CST 2006 (schema version 7)
#
# id :integer(11) not null
# name :string(255)
# description :text
# image_location :string(255)
# price :float default(0.0)
# available_at :datetime
#
class Product < ActiveRecord::Base
validates_presence_of :name, :description
. . .
~
一応バックアップはとってください.
** 情報源 [#r01e4b9a]
-[[rubylife - Ruby on Rails入門>http://www.rubylife.jp/rails/ini/index2.html]]
-[[takaaki's tips - Railsめも>http://homepage2.nifty.com/takaaki024/tips/main.html]]
** DEPRECATION WARNING 対処方法 [#a9bb1702]
*** end_form_tag [#k2cc9e63]
1. <%= start_form_tag ... %>
2. ...
3. <%= end_form_tag %>
↓下記に変更
1. <% form_tag ... do %>
2. ...
3. <% end %>
** 情報源 [#n832f587]
-[[RAILS forum - DEPRECATION WARNING: end_form_tag>http://railsforum.com/viewtopic.php?pid=17174]]