Ce diaporama a bien été signalé.
Le téléchargement de votre SlideShare est en cours. ×

Railsの基礎

Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Prochain SlideShare
サーバ構築実践入門
サーバ構築実践入門
Chargement dans…3
×

Consultez-les par la suite

1 sur 18 Publicité

Plus De Contenu Connexe

Les utilisateurs ont également aimé (20)

Similaire à Railsの基礎 (20)

Publicité

Railsの基礎

  1. 1. Ruby on Rails の基礎 @jishiha 13年1月10日木曜日
  2. 2. 参考 • Ruby on Rails の基礎 byドットインス トール http://dotinstall.com/lessons/ basic_rails • Ruby on Rails をこれから始める人への おすすめ本やおすすめ情報 http:// blog.champierre.com/963 13年1月10日木曜日
  3. 3. 環境構築 • Mac OS X 10.8 • Mac OS X 10.8 Mountain Lion に Ruby on Rails 環境をセットアップする http:// blog.champierre.com/961 13年1月10日木曜日
  4. 4. MVC? • Model データ • View 見た目 • Controller MとVを結ぶ処理 13年1月10日木曜日
  5. 5. 新しいプロジェクトの作成 • rails new blog • echo "rvm use ruby-1.9.3" > blog/.rvmrc • cd blog 13年1月10日木曜日
  6. 6. ファイル構成 • cd blog • subl . 13年1月10日木曜日
  7. 7. Web サーバーを起動 • rails s (WEBrick) • open http://localhost:3000 • 本当は pow のほうがオススメ http:// pow.cx/ 13年1月10日木曜日
  8. 8. scaffold • rails g scaffold Post title:string content:text • bundle exec rake db:migrate • open http://localhost:3000/posts 13年1月10日木曜日
  9. 9. DB(sqlite)の確認 • SQLite Manager https://addons.mozilla.org/ ja/firefox/addon/sqlite-manager/ 13年1月10日木曜日
  10. 10. URLの設定 • config/routes.rb を編集 • root :to => 'posts#index' を追加 13年1月10日木曜日
  11. 11. rails console • rails c • >> Post.all 13年1月10日木曜日
  12. 12. Controllerの編集 • respond_to do |format|... は削除 • def create/update/destroy では format.html {...} の {} 内を残す 13年1月10日木曜日
  13. 13. Viewの確認 • app/views/posts/index.html.erb • ファイル名がアクション名に対応 • @付き変数にアクセスできる • View の外枠は views/layouts/ application.html.erb で定義 13年1月10日木曜日
  14. 14. Rails と Sinatra の違い • link_to image_to などのヘルパーが便利 • <%= f.submit '投稿', disable_with: "処理 中..." %> 13年1月10日木曜日
  15. 15. Heroku に deploy(1) • Gemfile の編集 group :development do gem 'sqlite3' end group :production do gem 'pg' end 13年1月10日木曜日
  16. 16. Heroku に deploy(2) • bundle install • git init • git add . • git commit -a • /usr/local/heroku/bin/heroku create 13年1月10日木曜日
  17. 17. Heroku に deploy(3) • git push heroku master • /usr/local/heroku/bin/heroku run rake db:migrate • /usr/local/heroku/bin/heroku open 13年1月10日木曜日
  18. 18. つづく(かも) 13年1月10日木曜日

×