-
Notifications
You must be signed in to change notification settings - Fork 0
/
contributing_to_ruby_on_rails.html
702 lines (635 loc) · 50.5 KB
/
contributing_to_ruby_on_rails.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
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Contributing to Ruby on 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="Contributing to Ruby on 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>Contributing to Ruby on Rails</h2><p>This guide covers ways in which <em>you</em> can become a part of the ongoing development of Ruby on Rails.</p><p>After reading this guide, you will know:</p>
<ul>
<li>How to use GitHub to report issues.</li>
<li>How to clone master and run the test suite.</li>
<li>How to help resolve existing issues.</li>
<li>How to contribute to the Ruby on Rails documentation.</li>
<li>How to contribute to the Ruby on Rails code.</li>
</ul>
<p>Ruby on Rails is not "someone else's framework." Over the years, hundreds of people have contributed to Ruby on Rails ranging from a single character to massive architectural changes or significant documentation - all with the goal of making Ruby on Rails better for everyone. Even if you don't feel up to writing code or documentation yet, there are a variety of other ways that you can contribute, from reporting issues to testing patches.</p>
<div id="subCol">
<h3 class="chapter"><img src="images/chapters_icon.gif" alt="" />Chapters</h3>
<ol class="chapters">
<li>
<a href="#reporting-an-issue">Reporting an Issue</a>
<ul>
<li><a href="#creating-a-bug-report">Creating a Bug Report</a></li>
<li><a href="#create-a-self-contained-gist-for-active-record-and-action-controller-issues">Create a Self-Contained gist for Active Record and Action Controller Issues</a></li>
<li><a href="#special-treatment-for-security-issues">Special Treatment for Security Issues</a></li>
<li><a href="#what-about-feature-requests-questionmark">What about Feature Requests?</a></li>
</ul>
</li>
<li>
<a href="#helping-to-resolve-existing-issues">Helping to Resolve Existing Issues</a>
<ul>
<li><a href="#verifying-bug-reports">Verifying Bug Reports</a></li>
<li><a href="#testing-patches">Testing Patches</a></li>
</ul>
</li>
<li><a href="#contributing-to-the-rails-documentation">Contributing to the Rails Documentation</a></li>
<li>
<a href="#contributing-to-the-rails-code">Contributing to the Rails Code</a>
<ul>
<li><a href="#setting-up-a-development-environment">Setting Up a Development Environment</a></li>
<li><a href="#clone-the-rails-repository">Clone the Rails Repository</a></li>
<li><a href="#running-an-application-against-your-local-branch">Running an Application Against Your Local Branch</a></li>
<li><a href="#write-your-code">Write Your Code</a></li>
<li><a href="#benchmark-your-code">Benchmark Your Code</a></li>
<li><a href="#running-tests">Running Tests</a></li>
<li><a href="#warnings">Warnings</a></li>
<li><a href="#updating-the-changelog">Updating the CHANGELOG</a></li>
<li><a href="#sanity-check">Sanity Check</a></li>
<li><a href="#commit-your-changes">Commit Your Changes</a></li>
<li><a href="#update-your-branch">Update Your Branch</a></li>
<li><a href="#fork">Fork</a></li>
<li><a href="#issue-a-pull-request">Issue a Pull Request</a></li>
<li><a href="#get-some-feedback">Get some Feedback</a></li>
<li><a href="#iterate-as-necessary">Iterate as Necessary</a></li>
<li><a href="#older-versions-of-ruby-on-rails">Older Versions of Ruby on Rails</a></li>
</ul>
</li>
<li><a href="#rails-contributors">Rails Contributors</a></li>
</ol>
</div>
</div>
</div>
<div id="container">
<div class="wrapper">
<div id="mainCol">
<h3 id="reporting-an-issue">1 Reporting an Issue</h3><p>Ruby on Rails uses <a href="https://github.com/rails/rails/issues">GitHub Issue Tracking</a> to track issues (primarily bugs and contributions of new code). If you've found a bug in Ruby on Rails, this is the place to start. You'll need to create a (free) GitHub account in order to submit an issue, to comment on them or to create pull requests.</p><div class="note"><p>Bugs in the most recent released version of Ruby on Rails are likely to get the most attention. Also, the Rails core team is always interested in feedback from those who can take the time to test <em>edge Rails</em> (the code for the version of Rails that is currently under development). Later in this guide you'll find out how to get edge Rails for testing.</p></div><h4 id="creating-a-bug-report">1.1 Creating a Bug Report</h4><p>If you've found a problem in Ruby on Rails which is not a security risk, do a search in GitHub under <a href="https://github.com/rails/rails/issues">Issues</a> in case it has already been reported. If you do not find any issue addressing it you may proceed to <a href="https://github.com/rails/rails/issues/new">open a new one</a>. (See the next section for reporting security issues.)</p><p>Your issue report should contain a title and a clear description of the issue at the bare minimum. You should include as much relevant information as possible and should at least post a code sample that demonstrates the issue. It would be even better if you could include a unit test that shows how the expected behavior is not occurring. Your goal should be to make it easy for yourself - and others - to replicate the bug and figure out a fix.</p><p>Then, don't get your hopes up! Unless you have a "Code Red, Mission Critical, the World is Coming to an End" kind of bug, you're creating this issue report in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the issue report will automatically see any activity or that others will jump to fix it. Creating an issue like this is mostly to help yourself start on the path of fixing the problem and for others to confirm it with an "I'm having this problem too" comment.</p><h4 id="create-a-self-contained-gist-for-active-record-and-action-controller-issues">1.2 Create a Self-Contained gist for Active Record and Action Controller Issues</h4><p>If you are filing a bug report, please use
<a href="https://github.com/rails/rails/blob/master/guides/bug_report_templates/active_record_gem.rb">Active Record template for gems</a> or
<a href="https://github.com/rails/rails/blob/master/guides/bug_report_templates/action_controller_gem.rb">Action Controller template for gems</a>
if the bug is found in a published gem, and
<a href="https://github.com/rails/rails/blob/master/guides/bug_report_templates/active_record_master.rb">Active Record template for master</a> or
<a href="https://github.com/rails/rails/blob/master/guides/bug_report_templates/action_controller_master.rb">Action Controller template for master</a>
if the bug happens in the master branch.</p><h4 id="special-treatment-for-security-issues">1.3 Special Treatment for Security Issues</h4><div class="warning"><p>Please do not report security vulnerabilities with public GitHub issue reports. The <a href="http://rubyonrails.org/security">Rails security policy page</a> details the procedure to follow for security issues.</p></div><h4 id="what-about-feature-requests-questionmark">1.4 What about Feature Requests?</h4><p>Please don't put "feature request" items into GitHub Issues. If there's a new
feature that you want to see added to Ruby on Rails, you'll need to write the
code yourself - or convince someone else to partner with you to write the code.
Later in this guide you'll find detailed instructions for proposing a patch to
Ruby on Rails. If you enter a wish list item in GitHub Issues with no code, you
can expect it to be marked "invalid" as soon as it's reviewed.</p><p>Sometimes, the line between 'bug' and 'feature' is a hard one to draw.
Generally, a feature is anything that adds new behavior, while a bug is
anything that fixes already existing behavior that is misbehaving. Sometimes,
the core team will have to make a judgement call. That said, the distinction
generally just affects which release your patch will get in to; we love feature
submissions! They just won't get backported to maintenance branches.</p><p>If you'd like feedback on an idea for a feature before doing the work for make
a patch, please send an email to the <a href="https://groups.google.com/forum/?fromgroups#!forum/rubyonrails-core">rails-core mailing
list</a>. You
might get no response, which means that everyone is indifferent. You might find
someone who's also interested in building that feature. You might get a "This
won't be accepted." But it's the proper place to discuss new ideas. GitHub
Issues are not a particularly good venue for the sometimes long and involved
discussions new features require.</p><h3 id="helping-to-resolve-existing-issues">2 Helping to Resolve Existing Issues</h3><p>As a next step beyond reporting issues, you can help the core team resolve existing issues. If you check the <a href="https://github.com/rails/rails/issues">Everyone's Issues</a> list in GitHub Issues, you'll find lots of issues already requiring attention. What can you do for these? Quite a bit, actually:</p><h4 id="verifying-bug-reports">2.1 Verifying Bug Reports</h4><p>For starters, it helps just to verify bug reports. Can you reproduce the reported issue on your own computer? If so, you can add a comment to the issue saying that you're seeing the same thing.</p><p>If something is very vague, can you help squash it down into something specific? Maybe you can provide additional information to help reproduce a bug, or help by eliminating needless steps that aren't required to demonstrate the problem.</p><p>If you find a bug report without a test, it's very useful to contribute a failing test. This is also a great way to get started exploring the source code: looking at the existing test files will teach you how to write more tests. New tests are best contributed in the form of a patch, as explained later on in the "Contributing to the Rails Code" section.</p><p>Anything you can do to make bug reports more succinct or easier to reproduce is a help to folks trying to write code to fix those bugs - whether you end up writing the code yourself or not.</p><h4 id="testing-patches">2.2 Testing Patches</h4><p>You can also help out by examining pull requests that have been submitted to Ruby on Rails via GitHub. To apply someone's changes you need first to create a dedicated branch:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git checkout -b testing_branch
</pre>
</div>
<p>Then you can use their remote branch to update your codebase. For example, let's say the GitHub user JohnSmith has forked and pushed to a topic branch "orange" located at <a href="https://github.com/JohnSmith/rails">https://github.com/JohnSmith/rails</a>.</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git remote add JohnSmith git://github.com/JohnSmith/rails.git
$ git pull JohnSmith orange
</pre>
</div>
<p>After applying their branch, test it out! Here are some things to think about:</p>
<ul>
<li>Does the change actually work?</li>
<li>Are you happy with the tests? Can you follow what they're testing? Are there any tests missing?</li>
<li>Does it have the proper documentation coverage? Should documentation elsewhere be updated?</li>
<li>Do you like the implementation? Can you think of a nicer or faster way to implement a part of their change?</li>
</ul>
<p>Once you're happy that the pull request contains a good change, comment on the GitHub issue indicating your approval. Your comment should indicate that you like the change and what you like about it. Something like:</p>
<blockquote>
<p>I like the way you've restructured that code in generate_finder_sql - much nicer. The tests look good too.</p>
</blockquote>
<p>If your comment simply says "+1", then odds are that other reviewers aren't going to take it too seriously. Show that you took the time to review the pull request.</p><h3 id="contributing-to-the-rails-documentation">3 Contributing to the Rails Documentation</h3><p>Ruby on Rails has two main sets of documentation: the guides, which help you
learn about Ruby on Rails, and the API, which serves as a reference.</p><p>You can help improve the Rails guides by making them more coherent, consistent or readable, adding missing information, correcting factual errors, fixing typos, or bringing it up to date with the latest edge Rails. To get involved in the translation of Rails guides, please see <a href="https://wiki.github.com/rails/docrails/translating-rails-guides">Translating Rails Guides</a>.</p><p>You can either open a pull request to <a href="http://github.com/rails/rails">Rails</a> or
ask the <a href="http://rubyonrails.org/core">Rails core team</a> for commit access on
<a href="http://github.com/rails/docrails">docrails</a> if you contribute regularly.
Please do not open pull requests in docrails, if you'd like to get feedback on your
change, ask for it in <a href="http://github.com/rails/rails">Rails</a> instead.</p><p>Docrails is merged with master regularly, so you are effectively editing the Ruby on Rails documentation.</p><p>If you are unsure of the documentation changes, you can create an issue in the <a href="https://github.com/rails/rails/issues">Rails</a> issues tracker on GitHub.</p><p>When working with documentation, please take into account the <a href="api_documentation_guidelines.html">API Documentation Guidelines</a> and the <a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a>.</p><div class="note"><p>As explained earlier, ordinary code patches should have proper documentation coverage. Docrails is only used for isolated documentation improvements.</p></div><div class="note"><p>To help our CI servers you should add [ci skip] to your documentation commit message to skip build on that commit. Please remember to use it for commits containing only documentation changes.</p></div><div class="warning"><p>Docrails has a very strict policy: no code can be touched whatsoever, no matter how trivial or small the change. Only RDoc and guides can be edited via docrails. Also, CHANGELOGs should never be edited in docrails.</p></div><h3 id="contributing-to-the-rails-code">4 Contributing to the Rails Code</h3><h4 id="setting-up-a-development-environment">4.1 Setting Up a Development Environment</h4><p>To move on from submitting bugs to helping resolve existing issues or contributing your own code to Ruby on Rails, you <em>must</em> be able to run its test suite. In this section of the guide you'll learn how to setup the tests on your own computer.</p><h5 id="the-easy-way">4.1.1 The Easy Way</h5><p>The easiest and recommended way to get a development environment ready to hack is to use the <a href="https://github.com/rails/rails-dev-box">Rails development box</a>.</p><h5 id="the-hard-way">4.1.2 The Hard Way</h5><p>In case you can't use the Rails development box, see <a href="development_dependencies_install.html">this other guide</a>.</p><h4 id="clone-the-rails-repository">4.2 Clone the Rails Repository</h4><p>To be able to contribute code, you need to clone the Rails repository:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git clone git://github.com/rails/rails.git
</pre>
</div>
<p>and create a dedicated branch:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ cd rails
$ git checkout -b my_new_branch
</pre>
</div>
<p>It doesn't matter much what name you use, because this branch will only exist on your local computer and your personal repository on GitHub. It won't be part of the Rails Git repository.</p><h4 id="running-an-application-against-your-local-branch">4.3 Running an Application Against Your Local Branch</h4><p>In case you need a dummy Rails app to test changes, the <code>--dev</code> flag of <code>rails new</code> generates an application that uses your local branch:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ cd rails
$ bundle exec rails new ~/my-test-app --dev
</pre>
</div>
<p>The application generated in <code>~/my-test-app</code> runs against your local branch
and in particular sees any modifications upon server reboot.</p><h4 id="write-your-code">4.4 Write Your Code</h4><p>Now get busy and add/edit code. You're on your branch now, so you can write whatever you want (make sure you're on the right branch with <code>git branch -a</code>). But if you're planning to submit your change back for inclusion in Rails, keep a few things in mind:</p>
<ul>
<li>Get the code right.</li>
<li>Use Rails idioms and helpers.</li>
<li>Include tests that fail without your code, and pass with it.</li>
<li>Update the (surrounding) documentation, examples elsewhere, and the guides: whatever is affected by your contribution.</li>
</ul>
<div class="info"><p>Changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability of Rails will generally not be accepted (read more about <a href="https://github.com/rails/rails/pull/13771#issuecomment-32746700">our rationales behind this decision</a>).</p></div><h5 id="follow-the-coding-conventions">4.4.1 Follow the Coding Conventions</h5><p>Rails follows a simple set of coding style conventions:</p>
<ul>
<li>Two spaces, no tabs (for indentation).</li>
<li>No trailing whitespace. Blank lines should not have any spaces.</li>
<li>Indent after private/protected.</li>
<li>Use Ruby >= 1.9 syntax for hashes. Prefer <code>{ a: :b }</code> over <code>{ :a => :b }</code>.</li>
<li>Prefer <code>&&</code>/<code>||</code> over <code>and</code>/<code>or</code>.</li>
<li>Prefer class << self over self.method for class methods.</li>
<li>Use <code>MyClass.my_method(my_arg)</code> not <code>my_method( my_arg )</code> or <code>my_method my_arg</code>.</li>
<li>Use <code>a = b</code> and not <code>a=b</code>.</li>
<li>Use assert_not methods instead of refute.</li>
<li>Prefer <code>method { do_stuff }</code> instead of <code>method{do_stuff}</code> for single-line blocks.</li>
<li>Follow the conventions in the source you see used already.</li>
</ul>
<p>The above are guidelines - please use your best judgment in using them.</p><h4 id="benchmark-your-code">4.5 Benchmark Your Code</h4><p>If your change has an impact on the performance of Rails, please use the
<a href="https://github.com/evanphx/benchmark-ips">benchmark-ips</a> gem to provide
benchmark results for comparison.</p><p>Here's an example of using benchmark-ips:</p><div class="code_container">
<pre class="brush: ruby; gutter: false; toolbar: false">
require 'benchmark/ips'
Benchmark.ips do |x|
x.report('addition') { 1 + 2 }
x.report('addition with send') { 1.send(:+, 2) }
end
</pre>
</div>
<p>This will generate a report with the following information:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
Calculating -------------------------------------
addition 69114 i/100ms
addition with send 64062 i/100ms
-------------------------------------------------
addition 5307644.4 (±3.5%) i/s - 26539776 in 5.007219s
addition with send 3702897.9 (±3.5%) i/s - 18513918 in 5.006723s
</pre>
</div>
<p>Please see the benchmark/ips <a href="https://github.com/evanphx/benchmark-ips/blob/master/README.md">README</a> for more information.</p><h4 id="running-tests">4.6 Running Tests</h4><p>It is not customary in Rails to run the full test suite before pushing
changes. The railties test suite in particular takes a long time, and even
more if the source code is mounted in <code>/vagrant</code> as happens in the recommended
workflow with the <a href="https://github.com/rails/rails-dev-box">rails-dev-box</a>.</p><p>As a compromise, test what your code obviously affects, and if the change is
not in railties, run the whole test suite of the affected component. If all
tests are passing, that's enough to propose your contribution. We have
<a href="https://travis-ci.org/rails/rails">Travis CI</a> as a safety net for catching
unexpected breakages elsewhere.</p><h5 id="entire-rails">4.6.1 Entire Rails:</h5><p>To run all the tests, do:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ cd rails
$ bundle exec rake test
</pre>
</div>
<h5 id="for-a-particular-component">4.6.2 For a Particular Component</h5><p>You can run tests only for a particular component (e.g. Action Pack). For example,
to run Action Mailer tests:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ cd actionmailer
$ bundle exec rake test
</pre>
</div>
<h5 id="running-a-single-test">4.6.3 Running a Single Test</h5><p>You can run a single test through ruby. For instance:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ cd actionmailer
$ ruby -w -Itest test/mail_layout_test.rb -n test_explicit_class_layout
</pre>
</div>
<p>The <code>-n</code> option allows you to run a single method instead of the whole
file.</p><h6 id="testing-active-record">4.6.3.1 Testing Active Record</h6><p>This is how you run the Active Record test suite only for SQLite3:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ cd activerecord
$ bundle exec rake test:sqlite3
</pre>
</div>
<p>You can now run the tests as you did for <code>sqlite3</code>. The tasks are respectively</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
test:mysql
test:mysql2
test:postgresql
</pre>
</div>
<p>Finally,</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ bundle exec rake test
</pre>
</div>
<p>will now run the four of them in turn.</p><p>You can also run any single test separately:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ ARCONN=sqlite3 ruby -Itest test/cases/associations/has_many_associations_test.rb
</pre>
</div>
<p>To run a single test against all adapters, use:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ bundle exec rake TEST=test/cases/associations/has_many_associations_test.rb
</pre>
</div>
<p>You can invoke <code>test_jdbcmysql</code>, <code>test_jdbcsqlite3</code> or <code>test_jdbcpostgresql</code> also. See the file <code>activerecord/RUNNING_UNIT_TESTS.rdoc</code> for information on running more targeted database tests, or the file <code>ci/travis.rb</code> for the test suite run by the continuous integration server.</p><h4 id="warnings">4.7 Warnings</h4><p>The test suite runs with warnings enabled. Ideally, Ruby on Rails should issue no warnings, but there may be a few, as well as some from third-party libraries. Please ignore (or fix!) them, if any, and submit patches that do not issue new warnings.</p><p>If you are sure about what you are doing and would like to have a more clear output, there's a way to override the flag:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ RUBYOPT=-W0 bundle exec rake test
</pre>
</div>
<h4 id="updating-the-changelog">4.8 Updating the CHANGELOG</h4><p>The CHANGELOG is an important part of every release. It keeps the list of changes for every Rails version.</p><p>You should add an entry to the CHANGELOG of the framework that you modified if you're adding or removing a feature, committing a bug fix or adding deprecation notices. Refactorings and documentation changes generally should not go to the CHANGELOG.</p><p>A CHANGELOG entry should summarize what was changed and should end with author's name and it should go on top of a CHANGELOG. You can use multiple lines if you need more space and you can attach code examples indented with 4 spaces. If a change is related to a specific issue, you should attach the issue's number. Here is an example CHANGELOG entry:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
* Summary of a change that briefly describes what was changed. You can use multiple
lines and wrap them at around 80 characters. Code examples are ok, too, if needed:
class Foo
def bar
puts 'baz'
end
end
You can continue after the code example and you can attach issue number. GH#1234
*Your Name*
</pre>
</div>
<p>Your name can be added directly after the last word if you don't provide any code examples or don't need multiple paragraphs. Otherwise, it's best to make as a new paragraph.</p><h4 id="sanity-check">4.9 Sanity Check</h4><p>You should not be the only person who looks at the code before you submit it.
If you know someone else who uses Rails, try asking them if they'll check out
your work. If you don't know anyone else using Rails, try hopping into the IRC
room or posting about your idea to the rails-core mailing list. Doing this in
private before you push a patch out publicly is the "smoke test" for a patch:
if you can't convince one other developer of the beauty of your code, you’re
unlikely to convince the core team either.</p><h4 id="commit-your-changes">4.10 Commit Your Changes</h4><p>When you're happy with the code on your computer, you need to commit the changes to Git:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git commit -a
</pre>
</div>
<p>At this point, your editor should be fired up and you can write a message for this commit. Well formatted and descriptive commit messages are extremely helpful for the others, especially when figuring out why given change was made, so please take the time to write it.</p><p>Good commit message should be formatted according to the following example:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
Short summary (ideally 50 characters or less)
More detailed description, if necessary. It should be wrapped to 72
characters. Try to be as descriptive as you can, even if you think that
the commit content is obvious, it may not be obvious to others. You
should add such description also if it's already present in bug tracker,
it should not be necessary to visit a webpage to check the history.
Description can have multiple paragraphs and you can use code examples
inside, just indent it with 4 spaces:
class ArticlesController
def index
render json: Article.limit(10)
end
end
You can also add bullet points:
- you can use dashes or asterisks
- also, try to indent next line of a point for readability, if it's too
long to fit in 72 characters
</pre>
</div>
<div class="info"><p>Please squash your commits into a single commit when appropriate. This simplifies future cherry picks, and also keeps the git log clean.</p></div><h4 id="update-your-branch">4.11 Update Your Branch</h4><p>It's pretty likely that other changes to master have happened while you were working. Go get them:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git checkout master
$ git pull --rebase
</pre>
</div>
<p>Now reapply your patch on top of the latest changes:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git checkout my_new_branch
$ git rebase master
</pre>
</div>
<p>No conflicts? Tests still pass? Change still seems reasonable to you? Then move on.</p><h4 id="fork">4.12 Fork</h4><p>Navigate to the Rails <a href="https://github.com/rails/rails">GitHub repository</a> and press "Fork" in the upper right hand corner.</p><p>Add the new remote to your local repository on your local machine:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git remote add mine [email protected]:<your user name>/rails.git
</pre>
</div>
<p>Push to your remote:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git push mine my_new_branch
</pre>
</div>
<p>You might have cloned your forked repository into your machine and might want to add the original Rails repository as a remote instead, if that's the case here's what you have to do.</p><p>In the directory you cloned your fork:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git remote add rails git://github.com/rails/rails.git
</pre>
</div>
<p>Download new commits and branches from the official repository:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git fetch rails
</pre>
</div>
<p>Merge the new content:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git checkout master
$ git rebase rails/master
</pre>
</div>
<p>Update your fork:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git push origin master
</pre>
</div>
<p>If you want to update another branch:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git checkout branch_name
$ git rebase rails/branch_name
$ git push origin branch_name
</pre>
</div>
<h4 id="issue-a-pull-request">4.13 Issue a Pull Request</h4><p>Navigate to the Rails repository you just pushed to (e.g.
<a href="https://github.com/your-user-name/rails">https://github.com/your-user-name/rails</a>) and click on "Pull Requests" seen in
the right panel. On the next page, press "New pull request" in the upper right
hand corner.</p><p>Click on "Edit", if you need to change the branches being compared (it compares
"master" by default) and press "Click to create a pull request for this
comparison".</p><p>Ensure the changesets you introduced are included. Fill in some details about
your potential patch including a meaningful title. When finished, press "Send
pull request". The Rails core team will be notified about your submission.</p><h4 id="get-some-feedback">4.14 Get some Feedback</h4><p>Most pull requests will go through a few iterations before they get merged.
Different contributors will sometimes have different opinions, and often
patches will need revised before they can get merged.</p><p>Some contributors to Rails have email notifications from GitHub turned on, but
others do not. Furthermore, (almost) everyone who works on Rails is a
volunteer, and so it may take a few days for you to get your first feedback on
a pull request. Don't despair! Sometimes it's quick, sometimes it's slow. Such
is the open source life.</p><p>If it's been over a week, and you haven't heard anything, you might want to try
and nudge things along. You can use the <a href="http://groups.google.com/group/rubyonrails-core/">rubyonrails-core mailing
list</a> for this. You can also
leave another comment on the pull request.</p><p>While you're waiting for feedback on your pull request, open up a few other
pull requests and give someone else some! I'm sure they'll appreciate it in
the same way that you appreciate feedback on your patches.</p><h4 id="iterate-as-necessary">4.15 Iterate as Necessary</h4><p>It's entirely possible that the feedback you get will suggest changes. Don't get discouraged: the whole point of contributing to an active open source project is to tap into the knowledge of the community. If people are encouraging you to tweak your code, then it's worth making the tweaks and resubmitting. If the feedback is that your code doesn't belong in the core, you might still think about releasing it as a gem.</p><h5 id="squashing-commits">4.15.1 Squashing commits</h5><p>One of the things that we may ask you to do is to "squash your commits", which
will combine all of your commits into a single commit. We prefer pull requests
that are a single commit. This makes it easier to backport changes to stable
branches, squashing makes it easier to revert bad commits, and the git history
can be a bit easier to follow. Rails is a large project, and a bunch of
extraneous commits can add a lot of noise.</p><p>In order to do this, you'll need to have a git remote that points at the main
Rails repository. This is useful anyway, but just in case you don't have it set
up, make sure that you do this first:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git remote add upstream https://github.com/rails/rails.git
</pre>
</div>
<p>You can call this remote whatever you'd like, but if you don't use <code>upstream</code>,
then change the name to your own in the instructions below.</p><p>Given that your remote branch is called <code>my_pull_request</code>, then you can do the
following:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git fetch upstream
$ git checkout my_pull_request
$ git rebase upstream/master
$ git rebase -i
< Choose 'squash' for all of your commits except the first one. >
< Edit the commit message to make sense, and describe all your changes. >
$ git push origin my_pull_request -f
</pre>
</div>
<p>You should be able to refresh the pull request on GitHub and see that it has
been updated.</p><h5 id="updating-pull-request">4.15.2 Updating pull request</h5><p>Sometimes you will be asked to make some changes to the code you have
already committed. This can include amending existing commits. In this
case Git will not allow you to push the changes as the pushed branch
and local branch do not match. Instead of opening a new pull request,
you can force push to your branch on GitHub as described earlier in
squashing commits section:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git push origin my_pull_request -f
</pre>
</div>
<p>This will update the branch and pull request on GitHub with your new code. Do
note that using force push may result in commits being lost on the remote branch; use it with care.</p><h4 id="older-versions-of-ruby-on-rails">4.16 Older Versions of Ruby on Rails</h4><p>If you want to add a fix to older versions of Ruby on Rails, you'll need to set up and switch to your own local tracking branch. Here is an example to switch to the 4-0-stable branch:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git branch --track 4-0-stable origin/4-0-stable
$ git checkout 4-0-stable
</pre>
</div>
<div class="info"><p>You may want to <a href="http://qugstart.com/blog/git-and-svn/add-colored-git-branch-name-to-your-shell-prompt/">put your Git branch name in your shell prompt</a> to make it easier to remember which version of the code you're working with.</p></div><h5 id="backporting">4.16.1 Backporting</h5><p>Changes that are merged into master are intended for the next major release of Rails. Sometimes, it might be beneficial for your changes to propagate back to the maintenance releases for older stable branches. Generally, security fixes and bug fixes are good candidates for a backport, while new features and patches that introduce a change in behavior will not be accepted. When in doubt, it is best to consult a Rails team member before backporting your changes to avoid wasted effort.</p><p>For simple fixes, the easiest way to backport your changes is to <a href="http://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git">extract a diff from your changes in master and apply them to the target branch</a>.</p><p>First make sure your changes are the only difference between your current branch and master:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git log master..HEAD
</pre>
</div>
<p>Then extract the diff:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git format-patch master --stdout > ~/my_changes.patch
</pre>
</div>
<p>Switch over to the target branch and apply your changes:</p><div class="code_container">
<pre class="brush: plain; gutter: false; toolbar: false">
$ git checkout -b my_backport_branch 3-2-stable
$ git apply ~/my_changes.patch
</pre>
</div>
<p>This works well for simple changes. However, if your changes are complicated or if the code in master has deviated significantly from your target branch, it might require more work on your part. The difficulty of a backport varies greatly from case to case, and sometimes it is simply not worth the effort.</p><p>Once you have resolved all conflicts and made sure all the tests are passing, push your changes and open a separate pull request for your backport. It is also worth noting that older branches might have a different set of build targets than master. When possible, it is best to first test your backport locally against the Ruby versions listed in <code>.travis.yml</code> before submitting your pull request.</p><p>And then... think about your next contribution!</p><h3 id="rails-contributors">5 Rails Contributors</h3><p>All contributions, either via master or docrails, get credit in <a href="http://contributors.rubyonrails.org">Rails Contributors</a>.</p>
<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>