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.
- data/CHANGELOG +36 -49
- data/README.rdoc +2 -1
- data/guides/assets/stylesheets/fixes.css +16 -0
- data/guides/rails_guides.rb +2 -2
- data/guides/rails_guides/generator.rb +8 -3
- data/guides/rails_guides/textile_extensions.rb +4 -2
- data/guides/source/2_2_release_notes.textile +3 -3
- data/guides/source/2_3_release_notes.textile +2 -2
- data/guides/source/3_0_release_notes.textile +14 -14
- data/guides/source/action_controller_overview.textile +54 -79
- data/guides/source/action_mailer_basics.textile +39 -9
- data/guides/source/action_view_overview.textile +257 -211
- data/guides/source/active_record_basics.textile +1 -1
- data/guides/source/active_record_querying.textile +217 -27
- data/guides/source/active_record_validations_callbacks.textile +94 -25
- data/guides/source/active_support_core_extensions.textile +109 -77
- data/guides/source/ajax_on_rails.textile +15 -150
- data/guides/source/api_documentation_guidelines.textile +12 -12
- data/guides/source/association_basics.textile +74 -60
- data/guides/source/caching_with_rails.textile +59 -60
- data/guides/source/command_line.textile +46 -47
- data/guides/source/configuring.textile +55 -37
- data/guides/source/contribute.textile +7 -7
- data/guides/source/contributing_to_ruby_on_rails.textile +14 -23
- data/guides/source/credits.html.erb +3 -3
- data/guides/source/debugging_rails_applications.textile +59 -46
- data/guides/source/form_helpers.textile +76 -31
- data/guides/source/generators.textile +39 -40
- data/guides/source/getting_started.textile +73 -94
- data/guides/source/i18n.textile +64 -58
- data/guides/source/index.html.erb +3 -3
- data/guides/source/initialization.textile +634 -3284
- data/guides/source/layout.html.erb +6 -7
- data/guides/source/layouts_and_rendering.textile +59 -60
- data/guides/source/migrations.textile +63 -59
- data/guides/source/nested_model_forms.textile +2 -2
- data/guides/source/performance_testing.textile +16 -16
- data/guides/source/plugins.textile +236 -1280
- data/guides/source/rails_application_templates.textile +37 -29
- data/guides/source/rails_on_rack.textile +4 -9
- data/guides/source/routing.textile +96 -75
- data/guides/source/ruby_on_rails_guides_guidelines.textile +19 -12
- data/guides/source/security.textile +57 -30
- data/guides/source/testing.textile +26 -24
- data/guides/w3c_validator.rb +2 -2
- data/lib/rails.rb +1 -7
- data/lib/rails/application.rb +46 -76
- data/lib/rails/application/bootstrap.rb +6 -11
- data/lib/rails/application/configuration.rb +43 -40
- data/lib/rails/application/finisher.rb +16 -4
- data/lib/rails/application/railties.rb +6 -24
- data/lib/rails/application/routes_reloader.rb +45 -0
- data/lib/rails/backtrace_cleaner.rb +1 -1
- data/lib/rails/cli.rb +7 -5
- data/lib/rails/commands.rb +27 -2
- data/lib/rails/commands/application.rb +14 -1
- data/lib/rails/commands/benchmarker.rb +3 -1
- data/lib/rails/commands/dbconsole.rb +2 -2
- data/lib/rails/commands/destroy.rb +3 -1
- data/lib/rails/commands/generate.rb +3 -1
- data/lib/rails/commands/plugin.rb +2 -7
- data/lib/rails/commands/plugin_new.rb +10 -0
- data/lib/rails/commands/profiler.rb +3 -1
- data/lib/rails/commands/server.rb +4 -0
- data/lib/rails/configuration.rb +8 -81
- data/lib/rails/console/app.rb +2 -2
- data/lib/rails/engine.rb +460 -78
- data/lib/rails/engine/configuration.rb +46 -49
- data/lib/rails/engine/railties.rb +33 -0
- data/lib/rails/generators.rb +11 -5
- data/lib/rails/generators/actions.rb +2 -27
- data/lib/rails/generators/app_base.rb +216 -0
- data/lib/rails/generators/base.rb +3 -2
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb +1 -1
- data/lib/rails/generators/generated_attribute.rb +2 -1
- data/lib/rails/generators/migration.rb +6 -2
- data/lib/rails/generators/named_base.rb +79 -3
- data/lib/rails/generators/rails/app/app_generator.rb +44 -209
- data/lib/rails/generators/rails/app/templates/Gemfile +15 -31
- data/lib/rails/generators/rails/app/templates/README +2 -2
- data/lib/rails/generators/rails/app/templates/Rakefile +1 -1
- data/lib/rails/generators/rails/app/templates/{public → app/assets}/images/rails.png +0 -0
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +8 -0
- data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +5 -0
- data/lib/rails/generators/rails/app/templates/app/mailers/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/app/models/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +4 -4
- data/lib/rails/generators/rails/app/templates/config/application.rb +19 -3
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml +4 -4
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml +11 -6
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +1 -2
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +14 -11
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +5 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +12 -0
- data/lib/rails/generators/rails/app/templates/config/locales/en.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/routes.rb +1 -1
- data/lib/rails/generators/rails/app/templates/db/{seeds.rb → seeds.rb.tt} +2 -2
- data/lib/rails/generators/rails/app/templates/public/index.html +10 -8
- data/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/functional/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/integration/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/{test_helper.rb.tt → test_helper.rb} +0 -0
- data/lib/rails/generators/rails/app/templates/test/unit/.empty_directory +0 -0
- data/lib/rails/generators/rails/assets/USAGE +20 -0
- data/lib/rails/generators/rails/assets/assets_generator.rb +39 -0
- data/lib/rails/generators/rails/assets/templates/javascript.js +2 -0
- data/lib/rails/generators/rails/assets/templates/javascript.js.coffee +3 -0
- data/lib/rails/generators/rails/assets/templates/stylesheet.css +4 -0
- data/lib/rails/generators/rails/assets/templates/stylesheet.css.scss +5 -0
- data/lib/rails/generators/rails/controller/controller_generator.rb +1 -1
- data/lib/rails/generators/rails/controller/templates/controller.rb +2 -0
- data/lib/rails/generators/rails/generator/generator_generator.rb +2 -2
- data/lib/rails/generators/rails/generator/templates/templates/.empty_directory +0 -0
- data/lib/rails/generators/rails/helper/templates/helper.rb +2 -0
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +7 -0
- data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +4 -4
- data/lib/rails/generators/rails/plugin_new/USAGE +10 -0
- data/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb +303 -0
- data/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec +9 -0
- data/lib/rails/generators/rails/plugin_new/templates/Gemfile +11 -0
- data/lib/rails/generators/rails/plugin_new/templates/MIT-LICENSE +20 -0
- data/lib/rails/generators/rails/plugin_new/templates/README.rdoc +3 -0
- data/lib/rails/generators/rails/plugin_new/templates/Rakefile +21 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/controllers/%name%/application_controller.rb.tt +4 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/helpers/%name%/application_helper.rb.tt +4 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/models/.empty_directory +0 -0
- data/lib/rails/generators/rails/plugin_new/templates/config/routes.rb +6 -0
- data/lib/rails/generators/rails/plugin_new/templates/gitignore +6 -0
- data/lib/rails/generators/rails/plugin_new/templates/lib/%name%.rb +6 -0
- data/lib/rails/generators/rails/plugin_new/templates/lib/%name%/engine.rb +7 -0
- data/lib/rails/generators/rails/plugin_new/templates/lib/tasks/%name%_tasks.rake +4 -0
- data/lib/rails/generators/rails/plugin_new/templates/rails/application.rb +16 -0
- data/lib/rails/generators/rails/plugin_new/templates/rails/boot.rb +10 -0
- data/lib/rails/generators/rails/plugin_new/templates/rails/routes.rb +4 -0
- data/lib/rails/generators/rails/plugin_new/templates/script/rails.tt +5 -0
- data/lib/rails/generators/rails/plugin_new/templates/test/%name%_test.rb +7 -0
- data/lib/rails/generators/rails/plugin_new/templates/test/integration/navigation_test.rb +12 -0
- data/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb +10 -0
- data/lib/rails/generators/rails/resource/resource_generator.rb +2 -2
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +20 -1
- data/lib/rails/generators/rails/{stylesheets → scaffold}/templates/scaffold.css +0 -0
- data/lib/rails/generators/rails/scaffold/templates/scaffold.css.scss +58 -0
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +21 -19
- data/lib/rails/generators/resource_helpers.rb +3 -3
- data/lib/rails/generators/test_case.rb +2 -20
- data/lib/rails/generators/test_unit/controller/templates/functional_test.rb +5 -4
- data/lib/rails/generators/test_unit/helper/templates/helper_test.rb +2 -0
- data/lib/rails/generators/test_unit/integration/templates/integration_test.rb +3 -4
- data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb +5 -4
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml +1 -1
- data/lib/rails/generators/test_unit/model/templates/unit_test.rb +5 -4
- data/lib/rails/generators/test_unit/observer/templates/unit_test.rb +5 -4
- data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +3 -4
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +7 -5
- data/lib/rails/info.rb +0 -1
- data/lib/rails/paths.rb +119 -65
- data/lib/rails/plugin.rb +18 -19
- data/lib/rails/rack/log_tailer.rb +1 -1
- data/lib/rails/railtie.rb +50 -47
- data/lib/rails/railtie/configurable.rb +20 -10
- data/lib/rails/railtie/configuration.rb +20 -19
- data/lib/rails/source_annotation_extractor.rb +5 -5
- data/lib/rails/tasks.rb +1 -0
- data/lib/rails/tasks/assets.rake +10 -0
- data/lib/rails/tasks/documentation.rake +2 -8
- data/lib/rails/tasks/engine.rake +69 -0
- data/lib/rails/tasks/framework.rake +4 -21
- data/lib/rails/tasks/misc.rake +1 -1
- data/lib/rails/tasks/routes.rake +2 -1
- data/lib/rails/test_help.rb +17 -1
- data/lib/rails/test_unit/railtie.rb +1 -1
- data/lib/rails/test_unit/testing.rake +8 -3
- data/lib/rails/version.rb +3 -3
- metadata +128 -100
- checksums.yaml +0 -7
- data/lib/rails/application/configurable.rb +0 -19
- data/lib/rails/console/sandbox.rb +0 -6
- data/lib/rails/deprecation.rb +0 -41
- data/lib/rails/engine/configurable.rb +0 -25
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml +0 -62
- data/lib/rails/generators/rails/app/templates/public/javascripts/application.js +0 -2
- data/lib/rails/generators/rails/app/templates/public/javascripts/controls.js +0 -965
- data/lib/rails/generators/rails/app/templates/public/javascripts/dragdrop.js +0 -974
- data/lib/rails/generators/rails/app/templates/public/javascripts/effects.js +0 -1123
- data/lib/rails/generators/rails/app/templates/public/javascripts/prototype.js +0 -6001
- data/lib/rails/generators/rails/app/templates/public/javascripts/rails.js +0 -202
- data/lib/rails/generators/rails/stylesheets/USAGE +0 -5
- data/lib/rails/generators/rails/stylesheets/stylesheets_generator.rb +0 -9
- 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
|
-
})();
|
data/lib/rails/info_routes.rb
DELETED