-
Notifications
You must be signed in to change notification settings - Fork 0
/
rails_application_templates.html
464 lines (420 loc) · 24.3 KB
/
rails_application_templates.html
1
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Rails 應用程式模版 — Ruby on Rails 指南</title>
<meta name="description" content="Ruby on Rails 指南:系統學習 Rails(Rails 4.2 版本)" >
<meta name="keywords" content="Ruby on Rails Guides 指南 中文 學習 免費 網路 Web 開發" >
<meta name="author" content="http://git.io/G_R1sA">
<meta property="fb:admins" content="1340181291">
<meta property="og:title" content="Rails 應用程式模版 — Ruby on Rails 指南" >
<meta property="og:site_name" content="Ruby on Rails 指南">
<meta property="og:image" content="http://rails.ruby.tw/images/rails_guides_cover.jpg">
<meta property="og:url" content="http://rails.ruby.tw/">
<meta property="og:type" content="article">
<meta property="og:description" content="Ruby on Rails 指南:系統學習 Rails(Rails 4.2 版本)">
<link rel="stylesheet" href="stylesheets/application.css">
<link href="http://fonts.googleapis.com/css?family=Noto+Sans:400,700|Noto+Serif:700|Source+Code+Pro" rel="stylesheet">
<link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon">
</head>
<body class="guide">
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/zh-TW/sdk.js#xfbml=1&appId=837401439623727&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<script type="text/javascript">
window.twttr=(function(d,s,id){var t,js,fjs=d.getElementsByTagName(s)[0];if(d.getElementById(id)){return}js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);return window.twttr||(t={_e:[],ready:function(f){t._e.push(f)}})}(document,"script","twitter-wjs"));
</script>
<div id="topNav">
<div class="wrapper">
<strong class="more-info-label">更多內容 <a href="http://rubyonrails.org/">rubyonrails.org:</a></strong>
<span class="red-button more-info-button">
更多內容
</span>
<ul class="more-info-links s-hidden">
<li class="more-info"><a href="http://rubyonrails.org/">綜覽</a></li>
<li class="more-info"><a href="http://rubyonrails.org/download">下載</a></li>
<li class="more-info"><a href="http://rubyonrails.org/deploy">部署</a></li>
<li class="more-info"><a href="https://github.com/rails/rails">原始碼</a></li>
<li class="more-info"><a href="http://rubyonrails.org/screencasts">影片</a></li>
<li class="more-info"><a href="http://rubyonrails.org/documentation">文件</a></li>
<li class="more-info"><a href="http://rubyonrails.org/community">社群</a></li>
<li class="more-info"><a href="http://weblog.rubyonrails.org/">Blog</a></li>
</ul>
</div>
</div>
<div id="header">
<div class="wrapper clearfix">
<h1><a href="index.html" title="回首頁">Guides.rubyonrails.org</a></h1>
<ul class="nav">
<li><a class="nav-item" href="index.html">首頁</a></li>
<li class="guides-index guides-index-large">
<a href="index.html" id="guidesMenu" class="guides-index-item nav-item">指南目錄</a>
<div id="guides" class="clearfix" style="display: none;">
<hr>
<dl class="L">
<dt>起步走</dt>
<dd><a href="getting_started.html">Rails 起步走</a></dd>
<dt>Models</dt>
<dd><a href="active_record_basics.html">Active Record 基礎</a></dd>
<dd><a href="active_record_migrations.html">Active Record 遷移</a></dd>
<dd><a href="active_record_validations.html">Active Record 驗證</a></dd>
<dd><a href="active_record_callbacks.html">Active Record 回呼</a></dd>
<dd><a href="association_basics.html">Active Record 關聯</a></dd>
<dd><a href="active_record_querying.html">Active Record 查詢</a></dd>
<dt>Views</dt>
<dd><a href="layouts_and_rendering.html">Rails 算繪與版型</a></dd>
<dd><a href="form_helpers.html">Action View 表單輔助方法</a></dd>
<dt>Controllers</dt>
<dd><a href="action_controller_overview.html">Action Controller 綜覽</a></dd>
<dd><a href="routing.html">Rails 路由:深入淺出</a></dd>
</dl>
<dl class="R">
<dt>深入了解</dt>
<dd><a href="active_support_core_extensions.html">Active Support 核心擴展</a></dd>
<dd><a href="i18n.html">Rails 國際化 API</a></dd>
<dd><a href="action_mailer_basics.html">Action Mailer 基礎</a></dd>
<dd><a href="active_job_basics.html">Active Job 基礎</a></dd>
<dd><a href="security.html">Rails 安全指南</a></dd>
<dd><a href="debugging_rails_applications.html">除錯 Rails 應用程式</a></dd>
<dd><a href="configuring.html">Rails 應用程式設定</a></dd>
<dd><a href="command_line.html">Rake 任務與 Rails 命令列工具</a></dd>
<dd><a href="asset_pipeline.html">Asset Pipeline</a></dd>
<dd><a href="working_with_javascript_in_rails.html">在 Rails 使用 JavaScript</a></dd>
<dd><a href="constant_autoloading_and_reloading.html">Constant Autoloading and Reloading</a></dd>
<dt>擴充 Rails</dt>
<dd><a href="rails_on_rack.html">Rails on Rack</a></dd>
<dd><a href="generators.html">客製與新建 Rails 產生器</a></dd>
<dd><a href="rails_application_templates.html">Rails 應用程式模版</a></dd>
<dt>貢獻 Ruby on Rails</dt>
<dd><a href="contributing_to_ruby_on_rails.html">貢獻 Ruby on Rails</a></dd>
<dd><a href="api_documentation_guidelines.html">API 文件準則</a></dd>
<dd><a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails 指南準則</a></dd>
<dt>維護方針</dt>
<dd><a href="maintenance_policy.html">維護方針</a></dd>
<dt>發佈記</dt>
<dd><a href="upgrading_ruby_on_rails.html">升級 Ruby on Rails</a></dd>
<dd><a href="4_2_release_notes.html">Ruby on Rails 4.2 發佈記</a></dd>
<dd><a href="4_1_release_notes.html">Ruby on Rails 4.1 發佈記</a></dd>
<dd><a href="4_0_release_notes.html">Ruby on Rails 4.0 發佈記</a></dd>
<dd><a href="3_2_release_notes.html">Ruby on Rails 3.2 發佈記</a></dd>
<dd><a href="3_1_release_notes.html">Ruby on Rails 3.1 發佈記</a></dd>
<dd><a href="3_0_release_notes.html">Ruby on Rails 3.0 發佈記</a></dd>
<dd><a href="2_3_release_notes.html">Ruby on Rails 2.3 發佈記</a></dd>
<dd><a href="2_2_release_notes.html">Ruby on Rails 2.2 發佈記</a></dd>
<dt>Rails 指南翻譯術語</dt>
<dd><a href="translation_terms.html">翻譯術語</a></dd>
</dl>
</div>
</li>
<li><a class="nav-item" href="//github.com/docrails-tw/guides">貢獻翻譯</a></li>
<li><a class="nav-item" href="contributing_to_ruby_on_rails.html">貢獻</a></li>
<li><a class="nav-item" href="credits.html">致謝</a></li>
<li class="guides-index guides-index-small">
<select class="guides-index-item nav-item">
<option value="index.html">指南目錄</option>
<optgroup label="起步走">
<option value="getting_started.html">Rails 起步走</option>
</optgroup>
<optgroup label="Models">
<option value="active_record_basics.html">Active Record 基礎</option>
<option value="active_record_migrations.html">Active Record 遷移</option>
<option value="active_record_validations.html">Active Record 驗證</option>
<option value="active_record_callbacks.html">Active Record 回呼</option>
<option value="association_basics.html">Active Record 關聯</option>
<option value="active_record_querying.html">Active Record 查詢</option>
</optgroup>
<optgroup label="Views">
<option value="layouts_and_rendering.html">Rails 算繪與版型</option>
<option value="form_helpers.html">Action View 表單輔助方法</option>
</optgroup>
<optgroup label="Controllers">
<option value="action_controller_overview.html">Action Controller 綜覽</option>
<option value="routing.html">Rails 路由:深入淺出</option>
</optgroup>
<optgroup label="深入了解">
<option value="active_support_core_extensions.html">Active Support 核心擴展</option>
<option value="i18n.html">Rails 國際化 API</option>
<option value="action_mailer_basics.html">Action Mailer 基礎</option>
<option value="active_job_basics.html">Active Job 基礎</option>
<option value="security.html">Rails 安全指南</option>
<option value="debugging_rails_applications.html">除錯 Rails 應用程式</option>
<option value="configuring.html">Rails 應用程式設定</option>
<option value="command_line.html">Rake 任務與 Rails 命令列工具</option>
<option value="asset_pipeline.html">Asset Pipeline</option>
<option value="working_with_javascript_in_rails.html">在 Rails 使用 JavaScript</option>
<option value="constant_autoloading_and_reloading.html">Constant Autoloading and Reloading</option>
</optgroup>
<optgroup label="擴充 Rails">
<option value="rails_on_rack.html">Rails on Rack</option>
<option value="generators.html">客製與新建 Rails 產生器</option>
<option value="rails_application_templates.html">Rails 應用程式模版</option>
</optgroup>
<optgroup label="貢獻 Ruby on Rails">
<option value="contributing_to_ruby_on_rails.html">貢獻 Ruby on Rails</option>
<option value="api_documentation_guidelines.html">API 文件準則</option>
<option value="ruby_on_rails_guides_guidelines.html">Ruby on Rails 指南準則</option>
</optgroup>
<optgroup label="維護方針">
<option value="maintenance_policy.html">維護方針</option>
</optgroup>
<optgroup label="發佈記">
<option value="upgrading_ruby_on_rails.html">升級 Ruby on Rails</option>
<option value="4_2_release_notes.html">Ruby on Rails 4.2 發佈記</option>
<option value="4_1_release_notes.html">Ruby on Rails 4.1 發佈記</option>
<option value="4_0_release_notes.html">Ruby on Rails 4.0 發佈記</option>
<option value="3_2_release_notes.html">Ruby on Rails 3.2 發佈記</option>
<option value="3_1_release_notes.html">Ruby on Rails 3.1 發佈記</option>
<option value="3_0_release_notes.html">Ruby on Rails 3.0 發佈記</option>
<option value="2_3_release_notes.html">Ruby on Rails 2.3 發佈記</option>
<option value="2_2_release_notes.html">Ruby on Rails 2.2 發佈記</option>
</optgroup>
<optgroup label="Rails 指南翻譯術語">
<option value="translation_terms.html">翻譯術語</option>
</optgroup>
</select>
</li>
</ul>
</div>
</div>
</div>
<hr class="hide">
<div id="feature">
<div class="wrapper">
<h2>Rails 應用程式模版</h2><p>應用程式模版其實就是 Ruby 檔案,內含新增 Gems、Initializers 等的 DSL,用來建立、更新 Rails 專案。</p><p>讀完本篇,您將了解:</p>
<ul>
<li>如何使用模版來產生、客製化 Rails 應用程式。</li>
<li>如何使用 Rails 的模版 API 撰寫出可複用的應用程式模版。</li>
</ul>
<div id="subCol">
<h3 class="chapter"><img src="images/chapters_icon.gif" alt="" />Chapters</h3>
<ol class="chapters">
<li><a href="#%E7%94%A8%E9%80%94">用途</a></li>
<li>
<a href="#%E6%A8%A1%E7%89%88-api">模版 API</a>
<ul>
<li><a href="#gem-args">gem(*args)</a></li>
<li><a href="#gem-group-names-block">gem_group(*names, &block)</a></li>
<li><a href="#add-source-source-options">add_source(source, options = {})</a></li>
<li><a href="#environment-application-data-nil-options-block">environment/application(data=nil, options={}, &block)</a></li>
<li><a href="#vendor-lib-file-initializer-filename-data-nil-block">vendor/lib/file/initializer(filename, data = nil, &block)</a></li>
<li><a href="#rakefile-filename-data-nil-block">rakefile(filename, data = nil, &block)</a></li>
<li><a href="#generate-what-args">generate(what, *args)</a></li>
<li><a href="#run-command">run(command)</a></li>
<li><a href="#rake-command-options">rake(command, options = {})</a></li>
<li><a href="#route-routing-code">route(routing_code)</a></li>
<li><a href="#inside-dir">inside(dir)</a></li>
<li><a href="#ask-question">ask(question)</a></li>
<li><a href="#yes-questionmark-question-or-no-questionmark-question">yes?(question) or no?(question)</a></li>
<li><a href="#git-command">git(:command)</a></li>
</ul>
</li>
<li><a href="#%E9%80%B2%E9%9A%8E%E7%94%A8%E9%80%94">進階用途</a></li>
</ol>
</div>
</div>
</div>
<div id="container">
<div class="wrapper">
<div id="mainCol">
<h3 id="用途">1 用途</h3><p>要套用模版,首先需要提供 Rails 產生器並用 <code>-m</code> 選項附上模版的位置。位置可以是個檔案或是 URL。</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ rails new blog -m ~/template.rb
$ rails new blog -m http://example.com/template.rb
</pre>
</div>
<p>可以使用 <code>rake rails:template</code> 來套用模版到現有的 Rails 應用程式。模版的位置需要使用 <code>LOCATION</code> 這個環境變數傳入。再強調一次,模版的位置可以是檔案或 URL。</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ bin/rake rails:template LOCATION=~/template.rb
$ bin/rake rails:template LOCATION=http://example.com/template.rb
</pre>
</div>
<h3 id="模版-api">2 模版 API</h3><p>Rails 模版 API 很容易理解。看下面這個 Rails 模版的典型例子:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
# template.rb
generate(:scaffold, "person name:string")
route "root to: 'people#index'"
rake("db:migrate")
after_bundle do
git :init
git add: "."
git commit: %Q{ -m 'Initial commit' }
end
</pre>
</div>
<p>下節概述模版 API 主要提供的方法:</p><h4 id="gem-args">2.1 gem(*args)</h4><p>新增 <code>gem</code> 到應用程式的 <code>Gemfile</code>。</p><p>舉個例子,加入 <code>bj</code> 與 <code>nokogiri</code> 到 <code>Gemfile</code>:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
gem "bj"
gem "nokogiri"
</pre>
</div>
<p>請注意這不會安裝,要執行 <code>bundle install</code> 才會安裝:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
bundle install
</pre>
</div>
<h4 id="gem-group-names-block">2.2 gem_group(*names, &block)</h4><p>將 Gem 分組。</p><p>譬如只想要在開發與測試環境下載入 <code>rspec-rails</code>:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
gem_group :development, :test do
gem "rspec-rails"
end
</pre>
</div>
<h4 id="add-source-source-options">2.3 add_source(source, options = {})</h4><p>新增 RubyGems 來源網站到 <code>Gemfile</code>。</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
add_source "http://code.whytheluckystiff.net"
</pre>
</div>
<h4 id="environment-application-data-nil-options-block">2.4 environment/application(data=nil, options={}, &block)</h4><p>新增程式到 <code>config/application.rb</code>。</p><p>若有指定環境 <code>options[:env]</code>,則程式會加到 <code>config/environments</code> 下對應的環境設定檔裡。</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
environment 'config.action_mailer.default_url_options = {host: "http://yourwebsite.example.com"}', env: 'production'
</pre>
</div>
<p><code>data</code> 參數可以是區塊。</p><h4 id="vendor-lib-file-initializer-filename-data-nil-block">2.5 vendor/lib/file/initializer(filename, data = nil, &block)</h4><p>新增 initializer 到 <code>config/initializers</code> 目錄下。</p><p>假設想使用 <code>Object#not_nil?</code> 與 <code>Object#not_blank?</code>:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
initializer 'bloatlol.rb', <<-CODE
class Object
def not_nil?
!nil?
end
def not_blank?
!blank?
end
end
CODE
</pre>
</div>
<p><code>lib()</code> 則是在 <code>lib/</code> 目錄下建立檔案、<code>vender()</code> 在 <code>vender/</code> 目錄下建立檔案。</p><p>還有一個 <code>file()</code> 方法,可在 <code>Rails.root</code> 的相對路徑下同時建立目錄與檔案。</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
file 'app/components/foo.rb', <<-CODE
class Foo
end
CODE
</pre>
</div>
<p>這會建立出 <code>app/components</code> 目錄,並新增 <code>foo.rb</code>。</p><h4 id="rakefile-filename-data-nil-block">2.6 rakefile(filename, data = nil, &block)</h4><p>在 <code>lib/tasks</code> 建立 Rake 檔案:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
rakefile("bootstrap.rake") do
<<-TASK
namespace :boot do
task :strap do
puts "i like boots!"
end
end
TASK
end
</pre>
</div>
<h4 id="generate-what-args">2.7 generate(what, *args)</h4><p>使用給入的參數執行 Rails 的產生器:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
generate(:scaffold, "person", "name:string", "address:text", "age:number")
</pre>
</div>
<h4 id="run-command">2.8 run(command)</h4><p>執行任何命令,即反引號(<code>`</code>)。譬如想移除 <code>README.rdoc</code> 檔案:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
run "rm README.rdoc"
</pre>
</div>
<h4 id="rake-command-options">2.9 rake(command, options = {})</h4><p>執行指定的 Rake 任務。</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
rake "db:migrate"
</pre>
</div>
<p>也可以針對環境執行:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
rake "db:migrate", env: 'production'
</pre>
</div>
<h4 id="route-routing-code">2.10 route(routing_code)</h4><p>新增一筆路由到 <code>config/routes.rb</code>。譬如加一筆 <code>root</code> 路由:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
route "root to: 'person#index'"
</pre>
</div>
<h4 id="inside-dir">2.11 inside(dir)</h4><p>在特定目錄下執行命令:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
inside('vendor') do
run "ln -s ~/commit-rails/rails rails"
end
</pre>
</div>
<h4 id="ask-question">2.12 ask(question)</h4><p><code>ask()</code> 可以詢問使用者問題,並獲得使用者的輸入。比如詢問即將新增的函式庫名稱:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
lib_name = ask("What do you want to call the shiny library ?")
lib_name << ".rb" unless lib_name.index(".rb")
lib lib_name, <<-CODE
class Shiny
end
CODE
</pre>
</div>
<h4 id="yes-questionmark-question-or-no-questionmark-question">2.13 yes?(question) or no?(question)</h4><p>這兩個方法可以問問題,根據使用者的答案來決定執行流程。譬如根據使用者的回答,決定是否執行 <code>bundle package</code>:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
system("bundle package") if yes?("Package all gems?")
# no?(question) acts just the opposite.
</pre>
</div>
<h4 id="git-command">2.14 git(:command)</h4><p>Rails 模版可執行任何 git 命令:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
git :init
git add: "."
git commit: "-a -m 'Initial commit'"
</pre>
</div>
<h3 id="進階用途">3 進階用途</h3><p>應用程式模版在 <code>Rails::Generators::AppGenerator</code> 實體的上下文裡求值。使用了由 <a href="https://github.com/erikhuda/thor/blob/master/lib/thor/actions.rb#L209">Thor</a> 所提供的 <code>apply</code> 方法。這表示可以自己擴展、修改這個實體,以符所需。</p><p>舉個複寫 <code>source_paths</code> 方法的例子,讓 <code>source_path</code> 包含模版的位置。現在像是 <code>copy_file</code> 的方法會接受相對於模版的位置了。</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
def source_paths
[File.expand_path(File.dirname(__FILE__))]
end
</pre>
</div>
<h3>反饋</h3>
<p>
歡迎幫忙改善指南的品質。
</p>
<p>
如發現任何錯誤之處,歡迎修正。開始貢獻前,可以先閱讀<a href="http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#contributing-to-the-rails-documentation">貢獻指南:文件</a>。
</p>
<p>翻譯如有錯誤,深感抱歉,歡迎 <a href="https://github.com/docrails-tw/guides/fork">Fork</a> 修正,或至此處<a href="https://github.com/docsrails-tw/guides/issues/new">回報</a>。</p>
<p>
文章可能有未完成或過時的內容。請先檢查 <a href="http://edgeguides.rubyonrails.org">Edge Guides</a> 來確定問題在 master 是否已經修掉了。再上 master 補上缺少的文件。內容參考 <a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails 指南準則</a>來了解行文風格。
</p>
<p>最後,任何關於 Ruby on Rails 文件的討論,歡迎至 <a href="http://groups.google.com/group/rubyonrails-docs">rubyonrails-docs 郵件論壇</a>。
</p>
</div>
</div>
</div>
<hr class="hide">
<div id="footer">
<div class="wrapper">
<p>本著作係採用<a href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh_TW">創用 CC 姓名標示-相同方式分享 4.0 國際授權條款</a>授權。</p>
<p>“Rails”、“Ruby on Rails”,以及 Rails logo 為 David Heinemeier Hansson 的商標。版權所有。</p>
</div>
</div>
<script src="javascripts/jquery.min.js"></script>
<script src="javascripts/responsive-tables.js"></script>
<script src="javascripts/guides.js"></script>
<script src="javascripts/syntaxhighlighter/shCore.js"></script>
<script src="javascripts/syntaxhighlighter/shBrushRuby.js"></script>
<script src="javascripts/syntaxhighlighter/shBrushXml.js"></script>
<script src="javascripts/syntaxhighlighter/shBrushSql.js"></script>
<script src="javascripts/syntaxhighlighter/shBrushPlain.js"></script>
<script type="text/javascript">
SyntaxHighlighter.all();
$(guidesIndex.bind);
</script>
<script>
(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,"script","//www.google-analytics.com/analytics.js","ga");
ga("create", "UA-49903900-1", "auto");
ga("require", "displayfeatures");
ga("send", "pageview");
</script>
</body>
</html>