diff --git a/chapter1-mvc/c/respond_to__respond_with.md b/chapter1-mvc/c/respond_to__respond_with.md index b749131..3a20c45 100644 --- a/chapter1-mvc/c/respond_to__respond_with.md +++ b/chapter1-mvc/c/respond_to__respond_with.md @@ -1,6 +1,6 @@ # respond_to 與 respond_with -respond_to可以用來回應不同的資料格式,如果使用者要get www.example.com/ex.xml,rails會先尋找`ex.xml.erb`和`ex.xml.buulder`,最後會找`ex.html.erb`的檔案。 +respond_to可以用來回應不同的資料格式,如果使用者要get www.example.com/ex.xml,rails會先尋找`ex.xml.erb`和`ex.xml.builder`,最後會找`ex.html.erb`的檔案。 ```ruby def index diff --git a/chapter1-mvc/m/collections-id.md b/chapter1-mvc/m/collections-id.md index daf2d3d..f8e2e22 100644 --- a/chapter1-mvc/m/collections-id.md +++ b/chapter1-mvc/m/collections-id.md @@ -1,7 +1,7 @@ # collect(&:id) -基本上跟[map](../chapter3-ruby/map.md)是一樣的東西,collect做的事情就是將array內的資料一一拿出來處理,處理完後再傳回array +基本上跟[map](../../chapter3-ruby/map.md)是一樣的東西,collect做的事情就是將array內的資料一一拿出來處理,處理完後再傳回array 所以`topics.collect(&:id)`就是把topics內所有的id都拿出來存成另一個array ex: diff --git a/chapter3-ruby/map.md b/chapter3-ruby/map.md index 008b305..bf42e20 100644 --- a/chapter3-ruby/map.md +++ b/chapter3-ruby/map.md @@ -1,3 +1,3 @@ # map -基本上跟collect是一樣的方法,可以參考Model的[collect(&:id)](../chapter1-mvc/collect&id.md)介紹即可。 +基本上跟collect是一樣的方法,可以參考Model的[collect(&:id)](../chapter1-mvc/m/collections-id.md)介紹即可。 diff --git a/chapter4-ruby/loop.md b/chapter4-ruby/loop.md index d15a20c..d5619ca 100644 --- a/chapter4-ruby/loop.md +++ b/chapter4-ruby/loop.md @@ -5,7 +5,7 @@ ``` ruby 10.times {|n| puts "This is #{n}"} -10.times.do |n| +10.times do |n| puts "This is #{n}" puts "That is #{n*2}" end