SlideShare a Scribd company logo
1 of 45
RUBY ON RAILS 3 Tutorial  を日本語訳してみた Chapter 8-10 2011/12/07
Ruby on Rails Tutorial とは ,[object Object],[object Object]
前回のおさらい ,[object Object],[object Object],[object Object]
目次 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
目次 ,[object Object],[object Object],[object Object],[object Object],[object Object]
Chapter8 Sign up  ,[object Object],[object Object],[object Object]
Chapter8 Sign up ,[object Object],$ bundle exec rake db:reset
8.1.1 Using form_for ,[object Object],<%=   form_for ( @user )  do  | f |   %>    < div  class= &quot;field&quot; >      <%=   f. label   :name   %> < br  />      <%=   f. text_field   :name   %>     </ div >      < div  class= &quot;actions&quot; >      <%=   f.submit  &quot; Sign up &quot;   %>     </ div > <%   end  %>  
8.1.1 Using form_for ,[object Object],[object Object],[object Object],[object Object]
言い忘れ @Chap4 ,[object Object],[object Object],[object Object]
言い忘れ @Chap4 ,[object Object],[object Object],[object Object],[object Object],<%=   stylesheet_link_tag   ' blueprint/screen ' ,  :media  =>  ' screen '   %> <%=   stylesheet_link_tag   ' blueprint/print ' ,   :media  =>  ' print '   %>  
8.1.1 Using form_for ,[object Object],http://ruby.railstutorial.org/chapters/sign-up#top
8.2.1 Testing Failure ,[object Object]
8.2.3 Signup Error Messages ,[object Object],[object Object],$ rails console >> user = User.new(… 省略… , :email => “invalid”) >> user.save => false >>  user.errors.full_messages =>  [“Email is invalid”]
Box8.1 Integration alternatives ,[object Object],[object Object],[object Object]
Box8.1 Integration alternatives ,[object Object],[object Object],[object Object]
8.4.1 Integration Tests with Style ,[object Object],[object Object],[object Object],[object Object],$ rake generage integration_test users
目次 ,[object Object],[object Object],[object Object],[object Object],[object Object]
Chapter9 Sign in, sign out ,[object Object]
9.1.1 Sessions controller ,[object Object],SampleApp :: Application .routes.draw  do    resources   :users    resources   :sessions ,  :only  => [ :new ,  :create ,  :destroy ]    match   ' /signup ' ,   :to  =>  ' users#new '    match   ' /signin ' ,   :to  =>  ' sessions#new '    match   ' /signout ' ,  :to  =>  ' sessions#destroy ’ # 省略 end  
9.1.1 Sessions controller ,[object Object],HTTP リクエスト URL ルート名 Action 目的 GET /signin signin_path new ログイン画面 POST /sessions sessions_path create 新規セッション発行 DELETE /signout signout_path destroy セッション削除 ( ログアウト )
9.1.2 Signin form ,[object Object],<%=   form_for ( :session ,  :url  => sessions_path)  do  | f |   %>    < div  class= &quot;field&quot; >      <%=   f. label   :email   %> < br  />      <%=   f. text_field   :email   %>    </ div >    < div  class= &quot;field&quot; >      <%=   f. label   :password   %> < br  />      <%=   f. password_field   :password   %>    </ div >    < div  class= &quot;actions&quot; >      <%=   f.submit  &quot; Sign in &quot;   %>    </ div > <%   end   %>  
9.2.2 Failed signin(test and code) ,[object Object],   def   create     user =  User .authenticate( params [ :session ][ :email ],                               params [ :session ][ :password ])      if  user.nil?        flash .now[ :error ] =  &quot; Invalid email/password combination. &quot;        @title  =  &quot; Sign in &quot;        render   ' new '      else        # Sign the user in and redirect to the user's show page.      end    end  
9.2.2 Failed signin(test and code) ,[object Object],[object Object],[object Object]
Box 9.1 Flash dot now ,[object Object],[object Object],[object Object],[object Object],[object Object],http://trwtnb.blogspot.com/2009/11/rubyrailsflashnownoticeflashnotice.html
9.3.2 Remember me ,[object Object],[object Object],[object Object],[object Object],class   ApplicationController  <  ActionController :: Base    protect_from_forgery    include   SessionsHelper    end
9.3.3 Current user ,[object Object],[object Object],[object Object],[object Object],[object Object]
Box 9.4.What the *$@! is ||= ?  ,[object Object],[object Object],[object Object],>> 1 || nil => 1 >> 2 || 1 => 2 http://www.ruby-lang.org/ja/old-man/html/Ruby_A4C7BBC8A4EFA4ECA4EBB5ADB9E6A4CEB0D5CCA3.html
Box 9.5. 10 types of people ,[object Object],[object Object],[object Object],>> a = nil ? &quot;this is true&quot;:&quot;this is false” >> puts a this is false
9 章まとめ ,[object Object],[object Object],[object Object]
目次 ,[object Object],[object Object],[object Object],[object Object],[object Object]
Chapter10    Updating, showing, and deleting users ,[object Object],[object Object],[object Object]
10.3.2 Sample users ,[object Object],[object Object],[object Object],group  :development   do    gem   ‘ rspec-rails ’    gem   ‘ annotate ’ ,  :git  =>  ‘ git://github.com/ctran/annotate_models.git ’    gem   ‘ faker ’ end a
10.3.2 Sample users ,[object Object],$ bundle
10.3.2 Sample users ,[object Object],namespace   :db   do    desc   &quot; Fill database with sample data &quot;    task   :populate  =>  :environment   do      Rake :: Task [ ' db:reset ' ].invoke      User .create!( :name  =>  &quot; Example User &quot; ,                   :email  =>  &quot; [email_address] &quot; ,                   :password  =>  &quot; foobar &quot; ,                   :password_confirmation  =>  &quot; foobar &quot; )      99 .times  do  | n |       name  =  Faker :: Name .name       email =  &quot; example- #{ n+ 1 } @railstutorial.org &quot;       password  =  &quot; password &quot;        User .create!( :name  => name,                     :email  => email,                     :password  => password,                     :password_confirmation  => password)      end    end end  
拡大 namespace   :db   do    desc   “ Fill database with sample data ”    task   :populate  =>  :environment   do      Rake :: Task [ ‘ db:reset ’ ].invoke      User .create!( :name  =>  “ Example User ” ,                   :email  =>  “ [email_address] ” ,                   :password  =>  “ foobar ” ,                   :password_confirmation  =>  “ foobar ” )
拡大      99 .times  do  | n |       name  =  Faker :: Name .name       email =  “ example- #{ n+ 1 } @railstutorial.org ”       password  =  “ password ”        User .create!( :name  => name,                     :email  => email,                     :password  => password,                     :password_confirmation  => password)      end    end end
10.3.2 Sample users ,[object Object],$ bundle exec rake db:populate
10.3.3 Pagination ,[object Object],[object Object],group  :development   do    gem   ‘ rspec-rails ’    gem   ‘ annotate ’ ,  :git  =>  ‘ git://github.com/ctran/annotate_models.git ’    gem   ‘ faker ’    gem   ‘ will_paginate ’ end a $ bundle
10.3.3 Pagination ,[object Object],[object Object]
10.3.3 Pagination ,[object Object],< ul  class= &quot;users&quot; >    <%   @users .each  do  | user |  %>      < li >      <%=  gravatar_for user,  :size  =>  30   %>      <%=   link_to  user.name, user  %>      </ li >    <%   end   %> </ ul > <%=  will_paginate  %>  
10.3.3 Pagination ,[object Object],def   index      @title  =  “ All users ”      @users  =  User .paginate( :page  =>  params [ :page ]) end
10 章まとめ ,[object Object],[object Object],[object Object]
まとめ ,[object Object],[object Object],[object Object]
次回予告 ,[object Object],[object Object]

More Related Content

What's hot

Head First XML Layout on Android
Head First XML Layout on AndroidHead First XML Layout on Android
Head First XML Layout on AndroidYuki Anzai
 
WordPress widget api
WordPress widget apiWordPress widget api
WordPress widget apiTakami Kazuya
 
jQuery Performance Tips – jQueryにおける高速化 -
jQuery Performance Tips – jQueryにおける高速化 -jQuery Performance Tips – jQueryにおける高速化 -
jQuery Performance Tips – jQueryにおける高速化 -Hayato Mizuno
 
Componentization with Gilgamesh
Componentization with GilgameshComponentization with Gilgamesh
Componentization with GilgameshYusuke Goto
 
Rails and twitter #twtr_hack
Rails and twitter #twtr_hackRails and twitter #twtr_hack
Rails and twitter #twtr_hacki7a
 
concrete5デザインカスタマイズに必要なPHPの知識
concrete5デザインカスタマイズに必要なPHPの知識concrete5デザインカスタマイズに必要なPHPの知識
concrete5デザインカスタマイズに必要なPHPの知識Hishikawa Takuro
 
EC-CUBEプラグイン講義
EC-CUBEプラグイン講義EC-CUBEプラグイン講義
EC-CUBEプラグイン講義ria1201
 
Vue Router + Vuex
Vue Router + VuexVue Router + Vuex
Vue Router + VuexKei Yagi
 
WordPressプラグイン作成入門
WordPressプラグイン作成入門WordPressプラグイン作成入門
WordPressプラグイン作成入門Yuji Nojima
 
Magento meet up Tokyo#1 for Design
Magento meet up Tokyo#1 for DesignMagento meet up Tokyo#1 for Design
Magento meet up Tokyo#1 for DesignMiho Nakano
 
チュートリアルではじめるVue.js
チュートリアルではじめるVue.jsチュートリアルではじめるVue.js
チュートリアルではじめるVue.js小川 昌吾
 
Open Source System Administration Framework - Func
Open Source System Administration Framework - FuncOpen Source System Administration Framework - Func
Open Source System Administration Framework - FuncGosuke Miyashita
 
Web制作のアレコレ
Web制作のアレコレWeb制作のアレコレ
Web制作のアレコレregret raym
 
CakePHP Kansai 2008-12-12
CakePHP Kansai 2008-12-12CakePHP Kansai 2008-12-12
CakePHP Kansai 2008-12-12Yasuo Harada
 
プロダクトに 1 から Vue.js を導入した話
プロダクトに 1 から Vue.js を導入した話プロダクトに 1 から Vue.js を導入した話
プロダクトに 1 から Vue.js を導入した話Shohei Okada
 

What's hot (20)

Head First XML Layout on Android
Head First XML Layout on AndroidHead First XML Layout on Android
Head First XML Layout on Android
 
WordPress widget api
WordPress widget apiWordPress widget api
WordPress widget api
 
jQuery Performance Tips – jQueryにおける高速化 -
jQuery Performance Tips – jQueryにおける高速化 -jQuery Performance Tips – jQueryにおける高速化 -
jQuery Performance Tips – jQueryにおける高速化 -
 
ASP.NET MVC 1.0
ASP.NET MVC 1.0ASP.NET MVC 1.0
ASP.NET MVC 1.0
 
Componentization with Gilgamesh
Componentization with GilgameshComponentization with Gilgamesh
Componentization with Gilgamesh
 
Rails and twitter #twtr_hack
Rails and twitter #twtr_hackRails and twitter #twtr_hack
Rails and twitter #twtr_hack
 
concrete5デザインカスタマイズに必要なPHPの知識
concrete5デザインカスタマイズに必要なPHPの知識concrete5デザインカスタマイズに必要なPHPの知識
concrete5デザインカスタマイズに必要なPHPの知識
 
EC-CUBEプラグイン講義
EC-CUBEプラグイン講義EC-CUBEプラグイン講義
EC-CUBEプラグイン講義
 
Vue Router + Vuex
Vue Router + VuexVue Router + Vuex
Vue Router + Vuex
 
WordPressプラグイン作成入門
WordPressプラグイン作成入門WordPressプラグイン作成入門
WordPressプラグイン作成入門
 
Magento meet up Tokyo#1 for Design
Magento meet up Tokyo#1 for DesignMagento meet up Tokyo#1 for Design
Magento meet up Tokyo#1 for Design
 
Vue入門
Vue入門Vue入門
Vue入門
 
WordPress と Bootstrap
WordPress と BootstrapWordPress と Bootstrap
WordPress と Bootstrap
 
チュートリアルではじめるVue.js
チュートリアルではじめるVue.jsチュートリアルではじめるVue.js
チュートリアルではじめるVue.js
 
WordPressとjQuery
WordPressとjQueryWordPressとjQuery
WordPressとjQuery
 
Open Source System Administration Framework - Func
Open Source System Administration Framework - FuncOpen Source System Administration Framework - Func
Open Source System Administration Framework - Func
 
Web制作のアレコレ
Web制作のアレコレWeb制作のアレコレ
Web制作のアレコレ
 
jQuery Mobile入門
jQuery Mobile入門jQuery Mobile入門
jQuery Mobile入門
 
CakePHP Kansai 2008-12-12
CakePHP Kansai 2008-12-12CakePHP Kansai 2008-12-12
CakePHP Kansai 2008-12-12
 
プロダクトに 1 から Vue.js を導入した話
プロダクトに 1 から Vue.js を導入した話プロダクトに 1 から Vue.js を導入した話
プロダクトに 1 から Vue.js を導入した話
 

Similar to Ruby on Rails Tutorial Chapter8-10

More Better Nested Set
More Better Nested SetMore Better Nested Set
More Better Nested Setxibbar
 
Struts2を始めよう!
Struts2を始めよう!Struts2を始めよう!
Struts2を始めよう!Shinpei Ohtani
 
Ruby on Rails3 Tutorial Chapter2
Ruby on Rails3 Tutorial Chapter2Ruby on Rails3 Tutorial Chapter2
Ruby on Rails3 Tutorial Chapter2Sea Mountain
 
Rails基礎講座 part.2
Rails基礎講座 part.2Rails基礎講座 part.2
Rails基礎講座 part.2Jun Yokoyama
 
WTM53 phpフレームワーク いまさらcodeigniter
WTM53 phpフレームワーク いまさらcodeigniterWTM53 phpフレームワーク いまさらcodeigniter
WTM53 phpフレームワーク いまさらcodeigniterMasanori Oobayashi
 
ヒカルのGo 資料 Webアプリケーションの作り方
ヒカルのGo 資料 Webアプリケーションの作り方ヒカルのGo 資料 Webアプリケーションの作り方
ヒカルのGo 資料 Webアプリケーションの作り方Yosuke Furukawa
 
Rails初心者レッスン lesson3 3edition
Rails初心者レッスン lesson3 3editionRails初心者レッスン lesson3 3edition
Rails初心者レッスン lesson3 3editionSatomi Tsujita
 
初めてのPadrino
初めてのPadrino初めてのPadrino
初めてのPadrinoTakeshi Yabe
 
Inside mobage platform
Inside mobage platformInside mobage platform
Inside mobage platformToru Yamaguchi
 
仕事の手離れを良くする手段としての、静的検査のあるテンプレートエンジン (YATT::Lite talk at 2014 テンプレートエンジンNight)
仕事の手離れを良くする手段としての、静的検査のあるテンプレートエンジン (YATT::Lite talk at 2014 テンプレートエンジンNight)仕事の手離れを良くする手段としての、静的検査のあるテンプレートエンジン (YATT::Lite talk at 2014 テンプレートエンジンNight)
仕事の手離れを良くする手段としての、静的検査のあるテンプレートエンジン (YATT::Lite talk at 2014 テンプレートエンジンNight)Hiroaki KOBAYASHI
 
Ruby向け帳票ソリューション「ThinReports」の開発で知るOSSの威力
Ruby向け帳票ソリューション「ThinReports」の開発で知るOSSの威力Ruby向け帳票ソリューション「ThinReports」の開発で知るOSSの威力
Ruby向け帳票ソリューション「ThinReports」の開発で知るOSSの威力ThinReports
 
deviseを利用した認証について@Minamirb
deviseを利用した認証について@Minamirbdeviseを利用した認証について@Minamirb
deviseを利用した認証について@MinamirbJun Fukaya
 
Okinawa.rb 第2回勉強会
Okinawa.rb 第2回勉強会Okinawa.rb 第2回勉強会
Okinawa.rb 第2回勉強会Naoki Takaesu
 
Ruby on Rails3 Tutorial Chapter3
Ruby on Rails3 Tutorial Chapter3Ruby on Rails3 Tutorial Chapter3
Ruby on Rails3 Tutorial Chapter3Sea Mountain
 
20091030cakephphandson 01
20091030cakephphandson 0120091030cakephphandson 01
20091030cakephphandson 01Yusuke Ando
 
Oktopartial Introduction
Oktopartial IntroductionOktopartial Introduction
Oktopartial IntroductionTakeshi AKIMA
 
SQLマッピングフレームワーク「Kobati」のはなし
SQLマッピングフレームワーク「Kobati」のはなしSQLマッピングフレームワーク「Kobati」のはなし
SQLマッピングフレームワーク「Kobati」のはなしKazuki Minamitani
 
13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejs13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejsTakayoshi Tanaka
 

Similar to Ruby on Rails Tutorial Chapter8-10 (20)

More Better Nested Set
More Better Nested SetMore Better Nested Set
More Better Nested Set
 
Struts2を始めよう!
Struts2を始めよう!Struts2を始めよう!
Struts2を始めよう!
 
Ruby on Rails3 Tutorial Chapter2
Ruby on Rails3 Tutorial Chapter2Ruby on Rails3 Tutorial Chapter2
Ruby on Rails3 Tutorial Chapter2
 
Rails基礎講座 part.2
Rails基礎講座 part.2Rails基礎講座 part.2
Rails基礎講座 part.2
 
WTM53 phpフレームワーク いまさらcodeigniter
WTM53 phpフレームワーク いまさらcodeigniterWTM53 phpフレームワーク いまさらcodeigniter
WTM53 phpフレームワーク いまさらcodeigniter
 
ヒカルのGo 資料 Webアプリケーションの作り方
ヒカルのGo 資料 Webアプリケーションの作り方ヒカルのGo 資料 Webアプリケーションの作り方
ヒカルのGo 資料 Webアプリケーションの作り方
 
Rails初心者レッスン lesson3 3edition
Rails初心者レッスン lesson3 3editionRails初心者レッスン lesson3 3edition
Rails初心者レッスン lesson3 3edition
 
初めてのPadrino
初めてのPadrino初めてのPadrino
初めてのPadrino
 
Inside mobage platform
Inside mobage platformInside mobage platform
Inside mobage platform
 
仕事の手離れを良くする手段としての、静的検査のあるテンプレートエンジン (YATT::Lite talk at 2014 テンプレートエンジンNight)
仕事の手離れを良くする手段としての、静的検査のあるテンプレートエンジン (YATT::Lite talk at 2014 テンプレートエンジンNight)仕事の手離れを良くする手段としての、静的検査のあるテンプレートエンジン (YATT::Lite talk at 2014 テンプレートエンジンNight)
仕事の手離れを良くする手段としての、静的検査のあるテンプレートエンジン (YATT::Lite talk at 2014 テンプレートエンジンNight)
 
Ruby向け帳票ソリューション「ThinReports」の開発で知るOSSの威力
Ruby向け帳票ソリューション「ThinReports」の開発で知るOSSの威力Ruby向け帳票ソリューション「ThinReports」の開発で知るOSSの威力
Ruby向け帳票ソリューション「ThinReports」の開発で知るOSSの威力
 
deviseを利用した認証について@Minamirb
deviseを利用した認証について@Minamirbdeviseを利用した認証について@Minamirb
deviseを利用した認証について@Minamirb
 
Okinawa.rb 第2回勉強会
Okinawa.rb 第2回勉強会Okinawa.rb 第2回勉強会
Okinawa.rb 第2回勉強会
 
Git (運用編)
Git (運用編)Git (運用編)
Git (運用編)
 
Ruby on Rails3 Tutorial Chapter3
Ruby on Rails3 Tutorial Chapter3Ruby on Rails3 Tutorial Chapter3
Ruby on Rails3 Tutorial Chapter3
 
20091030cakephphandson 01
20091030cakephphandson 0120091030cakephphandson 01
20091030cakephphandson 01
 
Inside Movable Type
Inside Movable TypeInside Movable Type
Inside Movable Type
 
Oktopartial Introduction
Oktopartial IntroductionOktopartial Introduction
Oktopartial Introduction
 
SQLマッピングフレームワーク「Kobati」のはなし
SQLマッピングフレームワーク「Kobati」のはなしSQLマッピングフレームワーク「Kobati」のはなし
SQLマッピングフレームワーク「Kobati」のはなし
 
13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejs13016 n分で作るtype scriptでnodejs
13016 n分で作るtype scriptでnodejs
 

Recently uploaded

論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A surveyToru Tamaki
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...Toru Tamaki
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略Ryo Sasaki
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものですiPride Co., Ltd.
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Yuma Ohgami
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdftaisei2219
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNetToru Tamaki
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Danieldanielhu54
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムsugiuralab
 

Recently uploaded (9)

論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
 
SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdf
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Daniel
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システム
 

Ruby on Rails Tutorial Chapter8-10

  • 1. RUBY ON RAILS 3 Tutorial を日本語訳してみた Chapter 8-10 2011/12/07
  • 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.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36. 拡大 namespace   :db   do    desc   “ Fill database with sample data ”    task   :populate  =>  :environment   do      Rake :: Task [ ‘ db:reset ’ ].invoke      User .create!( :name  =>  “ Example User ” ,                   :email  =>  “ [email_address] ” ,                   :password  =>  “ foobar ” ,                   :password_confirmation  =>  “ foobar ” )
  • 37. 拡大      99 .times  do  | n |       name  =  Faker :: Name .name       email =  “ example- #{ n+ 1 } @railstutorial.org ”       password  =  “ password ”        User .create!( :name  => name,                     :email  => email,                     :password  => password,                     :password_confirmation  => password)      end    end end
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.

Editor's Notes

  1. どのようにテストを書くのか ユーザを作成できないとき、 new ページを表示するとき等のテストが書かれている
  2. ここでテストツールの話
  3. authenticate は渡された値のユーザが存在したときそのユーザ自身を返して、無かったときは nil を返すメソッドとして、 app/models/user.rb に定義されている