railties 3.0.20 → 3.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. data/CHANGELOG +36 -49
  2. data/README.rdoc +2 -1
  3. data/guides/assets/stylesheets/fixes.css +16 -0
  4. data/guides/rails_guides.rb +2 -2
  5. data/guides/rails_guides/generator.rb +8 -3
  6. data/guides/rails_guides/textile_extensions.rb +4 -2
  7. data/guides/source/2_2_release_notes.textile +3 -3
  8. data/guides/source/2_3_release_notes.textile +2 -2
  9. data/guides/source/3_0_release_notes.textile +14 -14
  10. data/guides/source/action_controller_overview.textile +54 -79
  11. data/guides/source/action_mailer_basics.textile +39 -9
  12. data/guides/source/action_view_overview.textile +257 -211
  13. data/guides/source/active_record_basics.textile +1 -1
  14. data/guides/source/active_record_querying.textile +217 -27
  15. data/guides/source/active_record_validations_callbacks.textile +94 -25
  16. data/guides/source/active_support_core_extensions.textile +109 -77
  17. data/guides/source/ajax_on_rails.textile +15 -150
  18. data/guides/source/api_documentation_guidelines.textile +12 -12
  19. data/guides/source/association_basics.textile +74 -60
  20. data/guides/source/caching_with_rails.textile +59 -60
  21. data/guides/source/command_line.textile +46 -47
  22. data/guides/source/configuring.textile +55 -37
  23. data/guides/source/contribute.textile +7 -7
  24. data/guides/source/contributing_to_ruby_on_rails.textile +14 -23
  25. data/guides/source/credits.html.erb +3 -3
  26. data/guides/source/debugging_rails_applications.textile +59 -46
  27. data/guides/source/form_helpers.textile +76 -31
  28. data/guides/source/generators.textile +39 -40
  29. data/guides/source/getting_started.textile +73 -94
  30. data/guides/source/i18n.textile +64 -58
  31. data/guides/source/index.html.erb +3 -3
  32. data/guides/source/initialization.textile +634 -3284
  33. data/guides/source/layout.html.erb +6 -7
  34. data/guides/source/layouts_and_rendering.textile +59 -60
  35. data/guides/source/migrations.textile +63 -59
  36. data/guides/source/nested_model_forms.textile +2 -2
  37. data/guides/source/performance_testing.textile +16 -16
  38. data/guides/source/plugins.textile +236 -1280
  39. data/guides/source/rails_application_templates.textile +37 -29
  40. data/guides/source/rails_on_rack.textile +4 -9
  41. data/guides/source/routing.textile +96 -75
  42. data/guides/source/ruby_on_rails_guides_guidelines.textile +19 -12
  43. data/guides/source/security.textile +57 -30
  44. data/guides/source/testing.textile +26 -24
  45. data/guides/w3c_validator.rb +2 -2
  46. data/lib/rails.rb +1 -7
  47. data/lib/rails/application.rb +46 -76
  48. data/lib/rails/application/bootstrap.rb +6 -11
  49. data/lib/rails/application/configuration.rb +43 -40
  50. data/lib/rails/application/finisher.rb +16 -4
  51. data/lib/rails/application/railties.rb +6 -24
  52. data/lib/rails/application/routes_reloader.rb +45 -0
  53. data/lib/rails/backtrace_cleaner.rb +1 -1
  54. data/lib/rails/cli.rb +7 -5
  55. data/lib/rails/commands.rb +27 -2
  56. data/lib/rails/commands/application.rb +14 -1
  57. data/lib/rails/commands/benchmarker.rb +3 -1
  58. data/lib/rails/commands/dbconsole.rb +2 -2
  59. data/lib/rails/commands/destroy.rb +3 -1
  60. data/lib/rails/commands/generate.rb +3 -1
  61. data/lib/rails/commands/plugin.rb +2 -7
  62. data/lib/rails/commands/plugin_new.rb +10 -0
  63. data/lib/rails/commands/profiler.rb +3 -1
  64. data/lib/rails/commands/server.rb +4 -0
  65. data/lib/rails/configuration.rb +8 -81
  66. data/lib/rails/console/app.rb +2 -2
  67. data/lib/rails/engine.rb +460 -78
  68. data/lib/rails/engine/configuration.rb +46 -49
  69. data/lib/rails/engine/railties.rb +33 -0
  70. data/lib/rails/generators.rb +11 -5
  71. data/lib/rails/generators/actions.rb +2 -27
  72. data/lib/rails/generators/app_base.rb +216 -0
  73. data/lib/rails/generators/base.rb +3 -2
  74. data/lib/rails/generators/erb/scaffold/templates/index.html.erb +1 -1
  75. data/lib/rails/generators/generated_attribute.rb +2 -1
  76. data/lib/rails/generators/migration.rb +6 -2
  77. data/lib/rails/generators/named_base.rb +79 -3
  78. data/lib/rails/generators/rails/app/app_generator.rb +44 -209
  79. data/lib/rails/generators/rails/app/templates/Gemfile +15 -31
  80. data/lib/rails/generators/rails/app/templates/README +2 -2
  81. data/lib/rails/generators/rails/app/templates/Rakefile +1 -1
  82. data/lib/rails/generators/rails/app/templates/{public → app/assets}/images/rails.png +0 -0
  83. data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +8 -0
  84. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +5 -0
  85. data/lib/rails/generators/rails/app/templates/app/mailers/.empty_directory +0 -0
  86. data/lib/rails/generators/rails/app/templates/app/models/.empty_directory +0 -0
  87. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +4 -4
  88. data/lib/rails/generators/rails/app/templates/config/application.rb +19 -3
  89. data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml +4 -4
  90. data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml +11 -6
  91. data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml +3 -3
  92. data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +1 -1
  93. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +1 -2
  94. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +14 -11
  95. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +5 -1
  96. data/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +1 -1
  97. data/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +12 -0
  98. data/lib/rails/generators/rails/app/templates/config/locales/en.yml +1 -1
  99. data/lib/rails/generators/rails/app/templates/config/routes.rb +1 -1
  100. data/lib/rails/generators/rails/app/templates/db/{seeds.rb → seeds.rb.tt} +2 -2
  101. data/lib/rails/generators/rails/app/templates/public/index.html +10 -8
  102. data/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory +0 -0
  103. data/lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory +0 -0
  104. data/lib/rails/generators/rails/app/templates/test/functional/.empty_directory +0 -0
  105. data/lib/rails/generators/rails/app/templates/test/integration/.empty_directory +0 -0
  106. data/lib/rails/generators/rails/app/templates/test/{test_helper.rb.tt → test_helper.rb} +0 -0
  107. data/lib/rails/generators/rails/app/templates/test/unit/.empty_directory +0 -0
  108. data/lib/rails/generators/rails/assets/USAGE +20 -0
  109. data/lib/rails/generators/rails/assets/assets_generator.rb +39 -0
  110. data/lib/rails/generators/rails/assets/templates/javascript.js +2 -0
  111. data/lib/rails/generators/rails/assets/templates/javascript.js.coffee +3 -0
  112. data/lib/rails/generators/rails/assets/templates/stylesheet.css +4 -0
  113. data/lib/rails/generators/rails/assets/templates/stylesheet.css.scss +5 -0
  114. data/lib/rails/generators/rails/controller/controller_generator.rb +1 -1
  115. data/lib/rails/generators/rails/controller/templates/controller.rb +2 -0
  116. data/lib/rails/generators/rails/generator/generator_generator.rb +2 -2
  117. data/lib/rails/generators/rails/generator/templates/templates/.empty_directory +0 -0
  118. data/lib/rails/generators/rails/helper/templates/helper.rb +2 -0
  119. data/lib/rails/generators/rails/plugin/plugin_generator.rb +7 -0
  120. data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +4 -4
  121. data/lib/rails/generators/rails/plugin_new/USAGE +10 -0
  122. data/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb +303 -0
  123. data/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec +9 -0
  124. data/lib/rails/generators/rails/plugin_new/templates/Gemfile +11 -0
  125. data/lib/rails/generators/rails/plugin_new/templates/MIT-LICENSE +20 -0
  126. data/lib/rails/generators/rails/plugin_new/templates/README.rdoc +3 -0
  127. data/lib/rails/generators/rails/plugin_new/templates/Rakefile +21 -0
  128. data/lib/rails/generators/rails/plugin_new/templates/app/controllers/%name%/application_controller.rb.tt +4 -0
  129. data/lib/rails/generators/rails/plugin_new/templates/app/helpers/%name%/application_helper.rb.tt +4 -0
  130. data/lib/rails/generators/rails/plugin_new/templates/app/models/.empty_directory +0 -0
  131. data/lib/rails/generators/rails/plugin_new/templates/config/routes.rb +6 -0
  132. data/lib/rails/generators/rails/plugin_new/templates/gitignore +6 -0
  133. data/lib/rails/generators/rails/plugin_new/templates/lib/%name%.rb +6 -0
  134. data/lib/rails/generators/rails/plugin_new/templates/lib/%name%/engine.rb +7 -0
  135. data/lib/rails/generators/rails/plugin_new/templates/lib/tasks/%name%_tasks.rake +4 -0
  136. data/lib/rails/generators/rails/plugin_new/templates/rails/application.rb +16 -0
  137. data/lib/rails/generators/rails/plugin_new/templates/rails/boot.rb +10 -0
  138. data/lib/rails/generators/rails/plugin_new/templates/rails/routes.rb +4 -0
  139. data/lib/rails/generators/rails/plugin_new/templates/script/rails.tt +5 -0
  140. data/lib/rails/generators/rails/plugin_new/templates/test/%name%_test.rb +7 -0
  141. data/lib/rails/generators/rails/plugin_new/templates/test/integration/navigation_test.rb +12 -0
  142. data/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb +10 -0
  143. data/lib/rails/generators/rails/resource/resource_generator.rb +2 -2
  144. data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +20 -1
  145. data/lib/rails/generators/rails/{stylesheets → scaffold}/templates/scaffold.css +0 -0
  146. data/lib/rails/generators/rails/scaffold/templates/scaffold.css.scss +58 -0
  147. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +21 -19
  148. data/lib/rails/generators/resource_helpers.rb +3 -3
  149. data/lib/rails/generators/test_case.rb +2 -20
  150. data/lib/rails/generators/test_unit/controller/templates/functional_test.rb +5 -4
  151. data/lib/rails/generators/test_unit/helper/templates/helper_test.rb +2 -0
  152. data/lib/rails/generators/test_unit/integration/templates/integration_test.rb +3 -4
  153. data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb +5 -4
  154. data/lib/rails/generators/test_unit/model/templates/fixtures.yml +1 -1
  155. data/lib/rails/generators/test_unit/model/templates/unit_test.rb +5 -4
  156. data/lib/rails/generators/test_unit/observer/templates/unit_test.rb +5 -4
  157. data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +3 -4
  158. data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +7 -5
  159. data/lib/rails/info.rb +0 -1
  160. data/lib/rails/paths.rb +119 -65
  161. data/lib/rails/plugin.rb +18 -19
  162. data/lib/rails/rack/log_tailer.rb +1 -1
  163. data/lib/rails/railtie.rb +50 -47
  164. data/lib/rails/railtie/configurable.rb +20 -10
  165. data/lib/rails/railtie/configuration.rb +20 -19
  166. data/lib/rails/source_annotation_extractor.rb +5 -5
  167. data/lib/rails/tasks.rb +1 -0
  168. data/lib/rails/tasks/assets.rake +10 -0
  169. data/lib/rails/tasks/documentation.rake +2 -8
  170. data/lib/rails/tasks/engine.rake +69 -0
  171. data/lib/rails/tasks/framework.rake +4 -21
  172. data/lib/rails/tasks/misc.rake +1 -1
  173. data/lib/rails/tasks/routes.rake +2 -1
  174. data/lib/rails/test_help.rb +17 -1
  175. data/lib/rails/test_unit/railtie.rb +1 -1
  176. data/lib/rails/test_unit/testing.rake +8 -3
  177. data/lib/rails/version.rb +3 -3
  178. metadata +128 -100
  179. checksums.yaml +0 -7
  180. data/lib/rails/application/configurable.rb +0 -19
  181. data/lib/rails/console/sandbox.rb +0 -6
  182. data/lib/rails/deprecation.rb +0 -41
  183. data/lib/rails/engine/configurable.rb +0 -25
  184. data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml +0 -62
  185. data/lib/rails/generators/rails/app/templates/public/javascripts/application.js +0 -2
  186. data/lib/rails/generators/rails/app/templates/public/javascripts/controls.js +0 -965
  187. data/lib/rails/generators/rails/app/templates/public/javascripts/dragdrop.js +0 -974
  188. data/lib/rails/generators/rails/app/templates/public/javascripts/effects.js +0 -1123
  189. data/lib/rails/generators/rails/app/templates/public/javascripts/prototype.js +0 -6001
  190. data/lib/rails/generators/rails/app/templates/public/javascripts/rails.js +0 -202
  191. data/lib/rails/generators/rails/stylesheets/USAGE +0 -5
  192. data/lib/rails/generators/rails/stylesheets/stylesheets_generator.rb +0 -9
  193. data/lib/rails/info_routes.rb +0 -3
@@ -1,202 +0,0 @@
1
- (function() {
2
- Ajax.Responders.register({
3
- onCreate: function(request) {
4
- var token = $$('meta[name=csrf-token]')[0];
5
- if (token) {
6
- if (!request.options.requestHeaders) request.options.requestHeaders = {};
7
- request.options.requestHeaders['X-CSRF-Token'] = token.readAttribute('content');
8
- }
9
- }
10
- });
11
-
12
- // Technique from Juriy Zaytsev
13
- // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/
14
- function isEventSupported(eventName) {
15
- var el = document.createElement('div');
16
- eventName = 'on' + eventName;
17
- var isSupported = (eventName in el);
18
- if (!isSupported) {
19
- el.setAttribute(eventName, 'return;');
20
- isSupported = typeof el[eventName] == 'function';
21
- }
22
- el = null;
23
- return isSupported;
24
- }
25
-
26
- function isForm(element) {
27
- return Object.isElement(element) && element.nodeName.toUpperCase() == 'FORM';
28
- }
29
-
30
- function isInput(element) {
31
- if (Object.isElement(element)) {
32
- var name = element.nodeName.toUpperCase();
33
- return name == 'INPUT' || name == 'SELECT' || name == 'TEXTAREA';
34
- }
35
- else return false;
36
- }
37
-
38
- var submitBubbles = isEventSupported('submit'),
39
- changeBubbles = isEventSupported('change');
40
-
41
- if (!submitBubbles || !changeBubbles) {
42
- // augment the Event.Handler class to observe custom events when needed
43
- Event.Handler.prototype.initialize = Event.Handler.prototype.initialize.wrap(
44
- function(init, element, eventName, selector, callback) {
45
- init(element, eventName, selector, callback);
46
- // is the handler being attached to an element that doesn't support this event?
47
- if ( (!submitBubbles && this.eventName == 'submit' && !isForm(this.element)) ||
48
- (!changeBubbles && this.eventName == 'change' && !isInput(this.element)) ) {
49
- // "submit" => "emulated:submit"
50
- this.eventName = 'emulated:' + this.eventName;
51
- }
52
- }
53
- );
54
- }
55
-
56
- if (!submitBubbles) {
57
- // discover forms on the page by observing focus events which always bubble
58
- document.on('focusin', 'form', function(focusEvent, form) {
59
- // special handler for the real "submit" event (one-time operation)
60
- if (!form.retrieve('emulated:submit')) {
61
- form.on('submit', function(submitEvent) {
62
- var emulated = form.fire('emulated:submit', submitEvent, true);
63
- // if custom event received preventDefault, cancel the real one too
64
- if (emulated.returnValue === false) submitEvent.preventDefault();
65
- });
66
- form.store('emulated:submit', true);
67
- }
68
- });
69
- }
70
-
71
- if (!changeBubbles) {
72
- // discover form inputs on the page
73
- document.on('focusin', 'input, select, textarea', function(focusEvent, input) {
74
- // special handler for real "change" events
75
- if (!input.retrieve('emulated:change')) {
76
- input.on('change', function(changeEvent) {
77
- input.fire('emulated:change', changeEvent, true);
78
- });
79
- input.store('emulated:change', true);
80
- }
81
- });
82
- }
83
-
84
- function handleRemote(element) {
85
- var method, url, params;
86
-
87
- var event = element.fire("ajax:before");
88
- if (event.stopped) return false;
89
-
90
- if (element.tagName.toLowerCase() === 'form') {
91
- method = element.readAttribute('method') || 'post';
92
- url = element.readAttribute('action');
93
- // serialize the form with respect to the submit button that was pressed
94
- params = element.serialize({ submit: element.retrieve('rails:submit-button') });
95
- // clear the pressed submit button information
96
- element.store('rails:submit-button', null);
97
- } else {
98
- method = element.readAttribute('data-method') || 'get';
99
- url = element.readAttribute('href');
100
- params = {};
101
- }
102
-
103
- new Ajax.Request(url, {
104
- method: method,
105
- parameters: params,
106
- evalScripts: true,
107
-
108
- onCreate: function(response) { element.fire("ajax:create", response); },
109
- onComplete: function(response) { element.fire("ajax:complete", response); },
110
- onSuccess: function(response) { element.fire("ajax:success", response); },
111
- onFailure: function(response) { element.fire("ajax:failure", response); }
112
- });
113
-
114
- element.fire("ajax:after");
115
- }
116
-
117
- function insertHiddenField(form, name, value) {
118
- form.insert(new Element('input', { type: 'hidden', name: name, value: value }));
119
- }
120
-
121
- function handleMethod(element) {
122
- var method = element.readAttribute('data-method'),
123
- url = element.readAttribute('href'),
124
- csrf_param = $$('meta[name=csrf-param]')[0],
125
- csrf_token = $$('meta[name=csrf-token]')[0];
126
-
127
- var form = new Element('form', { method: "POST", action: url, style: "display: none;" });
128
- $(element.parentNode).insert(form);
129
-
130
- if (method !== 'post') {
131
- insertHiddenField(form, '_method', method);
132
- }
133
-
134
- if (csrf_param) {
135
- insertHiddenField(form, csrf_param.readAttribute('content'), csrf_token.readAttribute('content'));
136
- }
137
-
138
- form.submit();
139
- }
140
-
141
- function disableFormElements(form) {
142
- form.select('input[type=submit][data-disable-with]').each(function(input) {
143
- input.store('rails:original-value', input.getValue());
144
- input.setValue(input.readAttribute('data-disable-with')).disable();
145
- });
146
- }
147
-
148
- function enableFormElements(form) {
149
- form.select('input[type=submit][data-disable-with]').each(function(input) {
150
- input.setValue(input.retrieve('rails:original-value')).enable();
151
- });
152
- }
153
-
154
- function allowAction(element) {
155
- var message = element.readAttribute('data-confirm');
156
- return !message || confirm(message);
157
- }
158
-
159
- document.on('click', 'a[data-confirm], a[data-remote], a[data-method]', function(event, link) {
160
- if (!allowAction(link)) {
161
- event.stop();
162
- return false;
163
- }
164
-
165
- if (link.readAttribute('data-remote')) {
166
- handleRemote(link);
167
- event.stop();
168
- } else if (link.readAttribute('data-method')) {
169
- handleMethod(link);
170
- event.stop();
171
- }
172
- });
173
-
174
- document.on("click", "form input[type=submit], form button[type=submit], form button:not([type])", function(event, button) {
175
- // register the pressed submit button
176
- event.findElement('form').store('rails:submit-button', button.name || false);
177
- });
178
-
179
- document.on("submit", function(event) {
180
- var form = event.findElement();
181
-
182
- if (!allowAction(form)) {
183
- event.stop();
184
- return false;
185
- }
186
-
187
- if (form.readAttribute('data-remote')) {
188
- handleRemote(form);
189
- event.stop();
190
- } else {
191
- disableFormElements(form);
192
- }
193
- });
194
-
195
- document.on('ajax:create', 'form', function(event, form) {
196
- if (form == event.findElement()) disableFormElements(form);
197
- });
198
-
199
- document.on('ajax:complete', 'form', function(event, form) {
200
- if (form == event.findElement()) enableFormElements(form);
201
- });
202
- })();
@@ -1,5 +0,0 @@
1
- Description:
2
- Copies scaffold stylesheets to public/stylesheets/.
3
-
4
- Examples:
5
- `rails generate stylesheets`
@@ -1,9 +0,0 @@
1
- module Rails
2
- module Generators
3
- class StylesheetsGenerator < Base
4
- def copy_stylesheets_file
5
- template "scaffold.css", "public/stylesheets/scaffold.css" if behavior == :invoke
6
- end
7
- end
8
- end
9
- end
@@ -1,3 +0,0 @@
1
- Rails.application.routes.draw do
2
- match '/rails/info/properties' => "rails/info#properties"
3
- end