「rubywavesチュートリアル」の編集履歴(バックアップ)一覧はこちら

rubywavesチュートリアル - (2008/05/03 (土) 16:17:02) の最新版との変更点

追加された行は緑色になります。

削除された行は赤色になります。

== メモ == *0.7.2だとwindowsで動かない、0.7.3r2なら動く。 *[fixme]windowsだとmigrationが正常に動かない? *モデルのリレーションでone_to_oneがdeprecatedになっている。many_to_oneを使うこと *モデルのリレーションで:fromがdeprecatedになっている。:classを使うこと *[fixme]DBをsqliteにするとcreated_onがnullになる? *[fixme]updated_onに値が入らないことがある? *チュートリアルのblogで日本語入れるとタイトルや名前部分は正常に表示されるがコメント等がfffdになる。 -> 定義外領域?textileで変換エラーぽい。gsubが$KCODEやjcode.rbを適切に設定するrubyの文化らしい。rails用のget-text関連をマージしたら幸せかも。リクエストラムダがらみを調べる   *waves-serverしたコマンドプロンプトはCtrl+Cで止めれない。 -> issue16。当面コマンドプロンプト起動しなおし *サーバ再起動しないと反映しない項目を調べる。 -> **databaseはOK **テーブル定義変更OK ** * editor.mabのフォームに input :name => '_method', :type => 'hidden', :value => 'put' 追加してもputにならない?(issue19) * gitにいろいろなバージョンがあってどれが正規かわかんね。 *技術評論社のチュートリアルの0.7.2のバグは0.7.3rc2でtextile以外は直ってる {| class="wikitable" |+ 多重度 ! 多重度 !! rubywaves !! rails |- ! 1:1 | || has_one |- ! 1:多 | one_to_many || has_many |- ! 多:多 | || has_and_belongs_to_many |- ! : | many_to_one || belongs_to |} == tutorial-1 == *雛形作成 *migration *[[ORM無しにwavesを使う]] http://www.rubywaves.com/filebase == tutorial-2 == *view作成 == tutorial-3 == *model controller mapping作成 == tutorial-4 == *css javascript == tutorial-5 == *login
開発の流れ #waves <アプリケーション名> *<waves_apps_root>\configurations\default.rb編集 *rake schema:migration name=initial_schema *<waves_apps_root>\schema\編集 *rake schema:migrate * #ビューの作成 *mkdir templates/<モデル名> *list.mab *add.mab *edit.mab #モデルの作成 *rake generate:model name=<モデル名> *<waves_apps_root>\models\編集 *関連追加 *migration #マッピングの作成 *<waves_apps_root>\configuration\mapping.rb編集 #RACK設定変更(static public files : css javascript) *<waves_apps_root>\configuration\development.rb編集 waves-server *<waves-home>\lib\runtime\server.rb *<waves_apps_root>\lib\startup.rb *<waves_apps_root>\lib\<アプリケーション名> **Sequel **AutoLoad **configurations **database **controllers **models **views ... waves-server OPTION -p --port=PORT -h --host=HOST -c --config=CONFIG -D --dir=DIR -d --daemon *mswin32ではforkがらみで動かない -u --debugger * windows だとオプション利かない? rubyは ''で囲むと文字列扱い ""で囲むと変数展開してくれる チュートリアル翻訳はma2さんの日記にわかりやすくあるので省略。 流れを記載して、0.7.3rc2での違いとかsqlite使うメモとか追加。 == tutorial-1 == *アプリケーション雛形作成 waves blog *[[ORM無しにwavesを使う]] http://www.rubywaves.com/filebase *設定編集 configurations/development.rb 編集 database :adapter を変更 'mysql' から 'sqlite' :database をblog.sqliteに変更 *データベースファイル作成 firefoxのSQLiteManager使うとお手軽。 アプリケーションルートにblog.sqliteで作成。 *migration rake schema:migration name=initial_schema scheme/migrations/001_initial_schema.rb 編集 (down メソッドも忘れずに) rake schema:migrate *waves-consoleで確認 waves-console デフォルトはSequelの文法に慣れると幸せ。ActiveRecodeと比べるとデフォルトで主キーが使えるくらい?ユーザ数が違うのであまりメリットないかも。 [[Ambition]]に将来を感じるがサポートされない。ParseTree使うとruby1.9で動かないらしい。waves でも ParseTree を dependent してたような... == tutorial-2 == *view作成 templates/entry ディレクトリ作成 templates/entry/list.mab 作成 layout ヘルパでデフォルトレイアウトを設定する。 @entries はlistビューなので自動で設定される。 view ヘルパで呼び込むレイアウトを入れ子に出来る。 templates/entry/summary.mab 作成 templates/entry/show.mab 作成 ブラウザで /entries にアクセスすると template/entry/list.mabが呼ばれる。 ブラウザで /entry/#name にアクセスすると template/entry/show.mabが呼ばれ、Entry テーブルから #name のレコードを表示する。 templates/entry/editor.mab 作成 == tutorial-3 == *model controller mapping作成 rake generate:model name=entry (Modelが無くても動いていた!) one_to_many :comment :class = xxx 外部キーになる側のmodelに :keyをつける (:from が deplicate で :classに変更される) rake generate:model name=comment one_to_one :entry :class = xxx templates/entry/show.mab 編集 view ヘルパでcomment入力欄とコメント一覧を設定 templates/comment/add.mab 作成 RESTなので新規の場合はPOST hiddenフィールドで :key に指定したフィールドを設定 templates/comment/list.mab 作成 configurations/mapping.rb 編集 # your custom rules go here 以下に新しいルールを記述する lib/mapping/mapping.rb に例がある created_onがnullになるので Model クラスに before_save を参考に after_create を追加する。 == tutorial-4 == *css javascript == tutorial-5 == *login

表示オプション

横に並べて表示:
変化行の前後のみ表示:
記事メニュー
目安箱バナー