Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chapter1-mvc/c/respond_to__respond_with.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion chapter1-mvc/m/collections-id.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion chapter3-ruby/map.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# map

基本上跟collect是一樣的方法,可以參考Model的[collect(&:id)](../chapter1-mvc/collect&id.md)介紹即可。
基本上跟collect是一樣的方法,可以參考Model的[collect(&:id)](../chapter1-mvc/m/collections-id.md)介紹即可。
2 changes: 1 addition & 1 deletion chapter4-ruby/loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down