Commit 7e41670c641f3e4e58fda817469fca6a89941905

updated to rails 1.99.1

Commit diff

README

 
174174config
175175 Configuration files for the Rails environment, the routing map, the database, and other dependencies.
176176
177components
178 Self-contained mini-applications that can bundle together controllers, models, and views.
179
180177db
181178 Contains the database schema in schema.rb. db/migrate contains all
182179 the sequence of Migrations for your schema.
toggle raw diff

app/controllers/application.rb

 
66
77 # See ActionController::RequestForgeryProtection for details
88 # Uncomment the :secret if you're not using the cookie session store
9 protect_from_forgery # :secret => 'cf37c500ea663c528c9cb02cf518b915'
9 protect_from_forgery # :secret => '33d4b3ee6fc0266b90063ecbf256076b'
1010end
toggle raw diff

config/boot.rb

 
66module Rails
77 class << self
88 def boot!
9 pick_boot.run unless booted?
9 unless booted?
10 preinitialize
11 pick_boot.run
12 end
1013 end
1114
1215 def booted?
2323 def vendor_rails?
2424 File.exist?("#{RAILS_ROOT}/vendor/rails")
2525 end
26
27 def preinitialize
28 load(preinitializer_path) if File.exists?(preinitializer_path)
29 end
30
31 def preinitializer_path
32 "#{RAILS_ROOT}/config/preinitializer.rb"
33 end
2634 end
2735
2836 class Boot
5555
5656 def load_rails_gem
5757 if version = self.class.gem_version
58 gem 'rails', "=#{version}"
58 gem 'rails', version
5959 else
6060 gem 'rails'
6161 end
9393 end
9494
9595 def parse_gem_version(text)
96 $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*'([\d.]+)'/
96 $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*'([!~<>=]*\s*[\d.]+)'/
9797 end
9898
9999 private
toggle raw diff

config/database.yml

 
22#
33# Install the MySQL driver:
44# gem install mysql
5# On MacOS X:
5# On Mac OS X:
66# sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
7# On Mac OS X Leopard:
8# sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
9# This sets the ARCHFLAGS environment variable to your native architecture
710# On Windows:
811# gem install mysql
912# Choose the win32 build.
1717development:
1818 adapter: mysql
1919 encoding: utf8
20 database: empty_app_development
20 database: rails-skeleton_development
2121 username: root
2222 password:
2323 socket: /var/run/mysqld/mysqld.sock
2828test:
2929 adapter: mysql
3030 encoding: utf8
31 database: empty_app_test
31 database: rails-skeleton_test
3232 username: root
3333 password:
3434 socket: /var/run/mysqld/mysqld.sock
3636production:
3737 adapter: mysql
3838 encoding: utf8
39 database: empty_app_production
39 database: rails-skeleton_production
4040 username: root
4141 password:
4242 socket: /var/run/mysqld/mysqld.sock
toggle raw diff

config/environment.rb

 
1# Be sure to restart your server when you modify this file.
1# Be sure to restart your server when you modify this file
22
33# Uncomment below to force Rails into production mode when
44# you don't control web/app server and can't set it the proper way
55# ENV['RAILS_ENV'] ||= 'production'
66
77# Specifies gem version of Rails to use when vendor/rails is not present
8RAILS_GEM_VERSION = '1.99.0' unless defined? RAILS_GEM_VERSION
8RAILS_GEM_VERSION = '1.99.1' unless defined? RAILS_GEM_VERSION
99
1010# Bootstrap the Rails environment, frameworks, and default configuration
1111require File.join(File.dirname(__FILE__), 'boot')
1212
1313Rails::Initializer.run do |config|
14 # Settings in config/environments/* take precedence over those specified here
14 # Settings in config/environments/* take precedence over those specified here.
15 # Application configuration should go into files in config/initializers
16 # -- all .rb files in that directory are automatically loaded.
17 # See Rails::Configuration for more options.
1518
16 # Skip frameworks you're not going to use (only works if using vendor/rails)
17 # config.frameworks -= [ :active_resource, :action_mailer ]
19 # Skip frameworks you're not going to use (only works if using vendor/rails).
20 # To use Rails without a database, you must remove the Active Record framework
21 # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
1822
19 # Only load the plugins named here, in the order given. By default, all plugins in vendor/plugins are loaded in alphabetical order.
20 # :all can be used as a placeholder for all plugins not explicitly named.
23 # Only load the plugins named here, in the order given. By default, all plugins
24 # in vendor/plugins are loaded in alphabetical order.
25 # :all can be used as a placeholder for all plugins not explicitly named
2126 # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
2227
2328 # Add additional load paths for your own custom dirs
3434
3535 # Your secret key for verifying cookie session data integrity.
3636 # If you change this key, all old sessions will become invalid!
37 # Make sure the secret is at least 30 characters and all random,
38 # no regular words or you'll be exposed to dictionary attacks.
3739 config.action_controller.session = {
38 :session_key => '_empty_app_session',
39 :secret => 'cf37c500ea663c528c9cb02cf518b915'
40 :session_key => '_rails-skeleton_session',
41 :secret => '5743a49340356dd047cbd67b2b9d0412b69ce923f20810e5a039c38293d0a80bafe89728fe2bde1f580dc5a5ac6f287ceaed055617ca7a268e42aa60f492397b'
4042 }
4143
4244 # Use the database for sessions instead of the cookie-based default,
5656
5757 # Make Active Record use UTC-base instead of local time
5858 # config.active_record.default_timezone = :utc
59
60 # See Rails::Configuration for more options
61
62 # Application configuration should go into files in config/initializers
63 # -- all .rb files in that directory are automatically loaded
64end
59end
toggle raw diff

config/environments/development.rb

 
1010
1111# Show full error reports and disable caching
1212config.action_controller.consider_all_requests_local = true
13config.action_view.debug_rjs = true
1314config.action_controller.perform_caching = false
1415config.action_view.cache_template_extensions = false
15config.action_view.debug_rjs = true
1616
1717# Don't care if the mailer can't send
18config.action_mailer.raise_delivery_errors = false
18config.action_mailer.raise_delivery_errors = false
toggle raw diff

public/javascripts/prototype.js

 
3636if (Prototype.Browser.MobileSafari)
3737 Prototype.BrowserFeatures.SpecificElementExtensions = false;
3838
39if (Prototype.Browser.WebKit)
40 Prototype.BrowserFeatures.XPath = false;
4139
4240/* Based on Alex Arnell's inheritance implementation. */
4341var Class = {
108108Object.extend(Object, {
109109 inspect: function(object) {
110110 try {
111 if (object === undefined) return 'undefined';
111 if (Object.isUndefined(object)) return 'undefined';
112112 if (object === null) return 'null';
113113 return object.inspect ? object.inspect() : object.toString();
114114 } catch (e) {
133133 var results = [];
134134 for (var property in object) {
135135 var value = Object.toJSON(object[property]);
136 if (value !== undefined)
136 if (!Object.isUndefined(value))
137137 results.push(property.toJSON() + ': ' + value);
138138 }
139139
202202 },
203203
204204 bind: function() {
205 if (arguments.length < 2 && arguments[0] === undefined) return this;
205 if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
206206 var __method = this, args = $A(arguments), object = args.shift();
207207 return function() {
208208 return __method.apply(object, args.concat($A(arguments)));
349349
350350 sub: function(pattern, replacement, count) {
351351 replacement = this.gsub.prepareReplacement(replacement);
352 count = count === undefined ? 1 : count;
352 count = Object.isUndefined(count) ? 1 : count;
353353
354354 return this.gsub(pattern, function(match) {
355355 if (--count < 0) return match[0];
364364
365365 truncate: function(length, truncation) {
366366 length = length || 30;
367 truncation = truncation === undefined ? '...' : truncation;
367 truncation = Object.isUndefined(truncation) ? '...' : truncation;
368368 return this.length > length ?
369369 this.slice(0, length - truncation.length) + truncation : String(this);
370370 },
484484 },
485485
486486 isJSON: function() {
487 var str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
487 var str = this;
488 if (str.blank()) return false;
489 str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
488490 return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
489491 },
490492
565565 if (before == '\\') return match[2];
566566
567567 var ctx = object, expr = match[3];
568 var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr);
568 var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
569 match = pattern.exec(expr);
569570 if (match == null) return before;
570571
571572 while (match != null) {
687687 },
688688
689689 inGroupsOf: function(number, fillWith) {
690 fillWith = fillWith === undefined ? null : fillWith;
690 fillWith = Object.isUndefined(fillWith) ? null : fillWith;
691691 return this.eachSlice(number, function(slice) {
692692 while(slice.length < number) slice.push(fillWith);
693693 return slice;
714714 var result;
715715 this.each(function(value, index) {
716716 value = iterator(value, index);
717 if (result == undefined || value >= result)
717 if (result == null || value >= result)
718718 result = value;
719719 });
720720 return result;
725725 var result;
726726 this.each(function(value, index) {
727727 value = iterator(value, index);
728 if (result == undefined || value < result)
728 if (result == null || value < result)
729729 result = value;
730730 });
731731 return result;
905905 var results = [];
906906 this.each(function(object) {
907907 var value = Object.toJSON(object);
908 if (value !== undefined) results.push(value);
908 if (!Object.isUndefined(value)) results.push(value);
909909 });
910910 return '[' + results.join(', ') + ']';
911911 }
985985};
986986
987987var Hash = Class.create(Enumerable, (function() {
988 if (function() {
989 var i = 0, Test = function(value) { this.key = value };
990 Test.prototype.key = 'foo';
991 for (var property in new Test('bar')) i++;
992 return i > 1;
993 }()) {
994 function each(iterator) {
995 var cache = [];
996 for (var key in this._object) {
997 var value = this._object[key];
998 if (cache.include(key)) continue;
999 cache.push(key);
1000 var pair = [key, value];
1001 pair.key = key;
1002 pair.value = value;
1003 iterator(pair);
1004 }
1005 }
1006 } else {
1007 function each(iterator) {
1008 for (var key in this._object) {
1009 var value = this._object[key], pair = [key, value];
1010 pair.key = key;
1011 pair.value = value;
1012 iterator(pair);
1013 }
1014 }
1015 }
1016988
1017989 function toQueryPair(key, value) {
1018990 if (Object.isUndefined(value)) return key;
996996 this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
997997 },
998998
999 _each: each,
999 _each: function(iterator) {
1000 for (var key in this._object) {
1001 var value = this._object[key], pair = [key, value];
1002 pair.key = key;
1003 pair.value = value;
1004 iterator(pair);
1005 }
1006 },
10001007
10011008 set: function(key, value) {
10021009 return this._object[key] = value;
11671167 Object.extend(this.options, options || { });
11681168
11691169 this.options.method = this.options.method.toLowerCase();
1170
11701171 if (Object.isString(this.options.parameters))
11711172 this.options.parameters = this.options.parameters.toQueryParams();
1173 else if (Object.isHash(this.options.parameters))
1174 this.options.parameters = this.options.parameters.toObject();
11721175 }
11731176});
11741177
13541354
13551355 if(readyState == 4) {
13561356 var xml = transport.responseXML;
1357 this.responseXML = xml === undefined ? null : xml;
1357 this.responseXML = Object.isUndefined(xml) ? null : xml;
13581358 this.responseJSON = this._getResponseJSON();
13591359 }
13601360 },
14001400 _getResponseJSON: function() {
14011401 var options = this.request.options;
14021402 if (!options.evalJSON || (options.evalJSON != 'force' &&
1403 !(this.getHeader('Content-type') || '').include('application/json')))
1404 return null;
1403 !(this.getHeader('Content-type') || '').include('application/json')) ||
1404 this.responseText.blank())
1405 return null;
14051406 try {
1406 return this.transport.responseText.evalJSON(options.sanitizeJSON);
1407 return this.responseText.evalJSON(options.sanitizeJSON);
14071408 } catch (e) {
14081409 this.request.dispatchException(e);
14091410 }
14181418 failure: (container.failure || (container.success ? null : container))
14191419 };
14201420
1421 options = options || { };
1421 options = Object.clone(options);
14221422 var onComplete = options.onComplete;
1423 options.onComplete = (function(response, param) {
1423 options.onComplete = (function(response, json) {
14241424 this.updateContent(response.responseText);
1425 if (Object.isFunction(onComplete)) onComplete(response, param);
1425 if (Object.isFunction(onComplete)) onComplete(response, json);
14261426 }).bind(this);
14271427
14281428 $super(url, options);
14441444 }
14451445 else receiver.update(responseText);
14461446 }
1447
1448 if (this.success()) {
1449 if (this.onComplete) this.onComplete.bind(this).defer();
1450 }
14511447 }
14521448});
14531449
16701670 },
16711671
16721672 descendants: function(element) {
1673 return $A($(element).getElementsByTagName('*')).each(Element.extend);
1673 return $(element).getElementsBySelector("*");
16741674 },
16751675
16761676 firstDescendant: function(element) {
17751775 var attributes = { }, t = Element._attributeTranslations.write;
17761776
17771777 if (typeof name == 'object') attributes = name;
1778 else attributes[name] = value === undefined ? true : value;
1778 else attributes[name] = Object.isUndefined(value) ? true : value;
17791779
17801780 for (var attr in attributes) {
1781 var name = t.names[attr] || attr, value = attributes[attr];
1781 name = t.names[attr] || attr;
1782 value = attributes[attr];
17821783 if (t.values[attr]) name = t.values[attr](element, value);
17831784 if (value === false || value === null)
17841785 element.removeAttribute(name);
18481848
18491849 descendantOf: function(element, ancestor) {
18501850 element = $(element), ancestor = $(ancestor);
1851 var originalAncestor = ancestor;
18511852
18521853 if (element.compareDocumentPosition)
18531854 return (element.compareDocumentPosition(ancestor) & 8) === 8;
18641864 }
18651865
18661866 while (element = element.parentNode)
1867 if (element == ancestor) return true;
1867 if (element == originalAncestor) return true;
18681868 return false;
18691869 },
18701870
19031903 if (property == 'opacity') element.setOpacity(styles[property]);
19041904 else
19051905 elementStyle[(property == 'float' || property == 'cssFloat') ?
1906 (elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') :
1906 (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
19071907 property] = styles[property];
19081908
19091909 return element;
22832283 return node ? node.value : "";
22842284 },
22852285 _getEv: function(element, attribute) {
2286 var attribute = element.getAttribute(attribute);
2286 attribute = element.getAttribute(attribute);
22872287 return attribute ? attribute.toString().slice(23, -2) : null;
22882288 },
22892289 _flag: function(element, attribute) {
27012701 this.compileMatcher();
27022702 },
27032703
2704 shouldUseXPath: function() {
2705 if (!Prototype.BrowserFeatures.XPath) return false;
2706
2707 var e = this.expression;
2708
2709 // Safari 3 chokes on :*-of-type and :empty
2710 if (Prototype.Browser.WebKit &&
2711 (e.include("-of-type") || e.include(":empty")))
2712 return false;
2713
2714 // XPath can't do namespaced attributes, nor can it read
2715 // the "checked" property from DOM nodes
2716 if ((/(\[[\w-]*?:|:checked)/).test(this.expression))
2717 return false;
2718
2719 return true;
2720 },
2721
27042722 compileMatcher: function() {
2705 // Selectors with namespaced attributes can't use the XPath version
2706 if (Prototype.BrowserFeatures.XPath && !(/(\[[\w-]*?:|:checked)/).test(this.expression))
2723 if (this.shouldUseXPath())
27072724 return this.compileXPathMatcher();
27082725
27092726 var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
28432843 },
28442844 className: "[contains(concat(' ', @class, ' '), ' #{1} ')]",
28452845 id: "[@id='#{1}']",
2846 attrPresence: "[@#{1}]",
2846 attrPresence: function(m) {
2847 m[1] = m[1].toLowerCase();
2848 return new Template("[@#{1}]").evaluate(m);
2849 },
28472850 attr: function(m) {
2851 m[1] = m[1].toLowerCase();
28482852 m[3] = m[5] || m[6];
28492853 return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
28502854 },
28772877 'enabled': "[not(@disabled)]",
28782878 'not': function(m) {
28792879 var e = m[6], p = Selector.patterns,
2880 x = Selector.xpath, le, m, v;
2880 x = Selector.xpath, le, v;
28812881
28822882 var exclusion = [];
28832883 while (e && le != e && (/\S/).test(e)) {
30543054 child: function(nodes) {
30553055 var h = Selector.handlers;
30563056 for (var i = 0, results = [], node; node = nodes[i]; i++) {
3057 for (var j = 0, children = [], child; child = node.childNodes[j]; j++)
3057 for (var j = 0, child; child = node.childNodes[j]; j++)
30583058 if (child.nodeType == 1 && child.tagName != '!') results.push(child);
30593059 }
30603060 return results;
33263326 },
33273327
33283328 findChildElements: function(element, expressions) {
3329 var exprs = expressions.join(','), expressions = [];
3329 var exprs = expressions.join(',');
3330 expressions = [];
33303331 exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
33313332 expressions.push(m[1].strip());
33323333 });
33403340 }
33413341});
33423342
3343if (Prototype.Browser.IE) {
3344 // IE returns comment nodes on getElementsByTagName("*").
3345 // Filter them out.
3346 Selector.handlers.concat = function(a, b) {
3347 for (var i = 0, node; node = b[i]; i++)
3348 if (node.tagName !== "!") a.push(node);
3349 return a;
3350 };
3351}
3352
33433353function $$() {
33443354 return Selector.findChildElements(document, $A(arguments));
33453355}
33613361
33623362 serializeElements: function(elements, options) {
33633363 if (typeof options != 'object') options = { hash: !!options };
3364 else if (options.hash === undefined) options.hash = true;
3364 else if (Object.isUndefined(options.hash)) options.hash = true;
33653365 var key, value, submitted = false, submit = options.submit;
33663366
33673367 var data = elements.inject({ }, function(result, element) {
35593559 },
35603560
35613561 inputSelector: function(element, value) {
3562 if (value === undefined) return element.checked ? element.value : null;
3562 if (Object.isUndefined(value)) return element.checked ? element.value : null;
35633563 else element.checked = !!value;
35643564 },
35653565
35663566 textarea: function(element, value) {
3567 if (value === undefined) return element.value;
3567 if (Object.isUndefined(value)) return element.value;
35683568 else element.value = value;
35693569 },
35703570
35713571 select: function(element, index) {
3572 if (index === undefined)
3572 if (Object.isUndefined(index))
35733573 return this[element.type == 'select-one' ?
35743574 'selectOne' : 'selectMany'](element);
35753575 else {
37603760
37613761 findElement: function(event, expression) {
37623762 var element = Event.element(event);
3763 return element.match(expression) ? element : element.up(expression);
3763 if (!expression) return element;
3764 var elements = [element].concat(element.ancestors());
3765 return Selector.findElement(elements, expression, 0);
37643766 },
37653767
37663768 pointer: function(event) {
39543954 element.fireEvent(event.eventType, event);
39553955 }
39563956
3957 return event;
3957 return Event.extend(event);
39583958 }
39593959 };
39603960})());
toggle raw diff

test/test_helper.rb

 
2525 self.use_instantiated_fixtures = false
2626
2727 # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
28 # If you need to control the loading order (due to foreign key constraints etc), you'll
29 # need to change this line to explicitly name the order you desire.
3028 #
3129 # Note: You'll currently still have to declare fixtures explicitly in integration tests
3230 # -- they do not yet inherit this setting
toggle raw diff