Commit Graph

2309 Commits

Author SHA1 Message Date
Xavier Noria
7f07cc364a Merge remote branch 'rails/master' 2010-05-19 23:29:39 +02:00
Xavier Noria
b9fcd8d71f in Ruby things in general happen at runtime, no need to specify that 2010-05-19 23:27:09 +02:00
Neeraj Singh
39a246f545 Final iteration of use better testing methods
[#4652 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-19 21:31:51 +02:00
Neeraj Singh
1c3d2a5a60 Updating the doc with the info that class_inheritable_accessor
copies properties to child at runtime
2010-05-19 01:29:15 -04:00
Xavier Noria
b753b4a076 removes deprecations of last_(month|year) from master, they will be deprecated in 2.3 instead 2010-05-19 00:20:10 +02:00
Neeraj Singh
0dab076a08 Better error messages for some of ActiveSupport tests
[#4635 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-18 16:12:59 +02:00
Rizwan Reza
8c5e1652c7 Renames Array#rand -> Array#random_element
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-05-17 23:03:16 +02:00
wycats
80b60671f7 Revert "Moved encoding work in progress to a feature branch."
This reverts commit ade756fe42423033bae8e5aea8f58782f7a6c517.
2010-05-17 19:41:54 +04:00
Jeremy Kemper
ade756fe42 Moved encoding work in progress to a feature branch.
This reverts commits af0d1a88157942c6e6398dbf73891cff1e152405 and 64d109e3539ad600f58536d3ecabd2f87b67fd1c.
2010-05-16 13:55:29 -07:00
Santiago Pastorino
821e15e5f2 Change on Array extension from rand => random_element [#4555 state:committed]
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-05-16 22:23:44 +02:00
wycats
af0d1a8815 Initial work to improve the state of encodings for templates 2010-05-16 22:43:35 +04:00
Santiago Pastorino
fdfebb7782 Make use of assert_equal to test equallity between object assert expects and object and a message of error
[#4611 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 16:06:28 +02:00
wycats
9cfeefb637 Reorganized initializers a bit to enable better hooks for common cases without the need for Railtie. Specifically, the following hooks were added:
* before_configuration: this hook is run immediately after the Application class 
  comes into existence, but before the user has added any configuration. This is
  the appropriate place to set configuration for your plugin
* before_initialize: This is run after all of the user's configuration has completed,
  but before any initializers have begun (in other words, it runs right after
  config/environments/{development,production,test}.rb)
* after_initialize: This is run after all of the initializers have run. It is an
  appropriate place for forking in a preforking setup

Each of these hooks may be used via ActiveSupport.on_load(name) { }. In all these cases, the context inside the block will be the Application object. This means that for simple cases, you can use these hooks without needing to create a Railtie.
2010-05-15 06:09:07 -07:00
Carlos Antonio da Silva
c77794a924 Add missing require to with_options [#4601 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 14:54:07 +02:00
Neeraj Singh
a0621c1086 Better code formatting and proper line numbers for stack traces
[#4596 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-14 12:24:01 -07:00
Xavier Noria
2203c781a7 defines prev_(month|year) in Date and Time to ease transition to 1.9, and deprecates last_(month|year) 2010-05-12 23:04:17 +02:00
Xavier Noria
df508bd970 aliases Date#sunday to Date#end_of_week, for symmetry with existing alias Date#monday -> Date#beginning_of_week 2010-05-09 11:16:34 +02:00
Xavier Noria
2969543cef adds calendar reform test coverage for more relevant date calculations 2010-05-09 10:26:21 +02:00
Xavier Noria
636ffa1f08 Backports Date#>> from 1.9 so that calculations do the right thing around the calendar reform
Our next_month gives November for some late dates in September of 1582.
Related methods, last_*, and in general advance have the same issues.
This commit fixes those, see the test suite for expected behavior, which
we still run in 1.9 to ensure it matches as we do with other methods
defined in Date in 1.9.
2010-05-09 01:20:23 +02:00
Xavier Noria
7184a9e643 add test coverage for (last|next)_year on leap years 2010-05-08 18:46:15 +02:00
Xavier Noria
f2072a323c adds Date#to_time refinement from previous commit to the CHANGELOG 2010-05-05 00:48:31 +02:00
Xavier Noria
53c1cd6cde let Time.time_with_datetime_fallback handle properly years in the range 0..138 2010-05-05 00:35:06 +02:00
Xavier Noria
6704d8c994 date/conversions needs time/calculations for (utc|local)_time 2010-05-03 23:11:09 +02:00
Xavier Noria
5d7d0c2fa3 BigDecimal#as_json does not really specify the F format, it delegates that to whatever BigDecimal#to_s default format is, do the same in its test 2010-05-03 22:11:33 +02:00
Xavier Noria
9e085a9f33 adds a comment explaining why BigDecimal#as_json returns a JSON string 2010-05-03 22:04:47 +02:00
Xavier Noria
34d5725167 fixes colon in previous YAML example 2010-05-03 15:25:28 +02:00
Norman Clarke
756f762cdb Fix transliteration rule example in docs. [#4526 state:resolved]
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-05-03 15:22:52 +02:00
José Valim
36fc489aa3 Update I18n gem to 0.4.0.beta1 [#4525 state:resolved]. 2010-05-03 13:45:36 +02:00
Xavier Noria
0e00f428a8 adds test coverage for Date.current vs Date.today in Date.(yesterday|tomorrow) implementation 2010-05-03 00:03:32 +02:00
José Valim
a76c7e68d5 Event should be aware if yielded block failed or not. 2010-05-02 22:45:54 +02:00
Justin George
731d4392e4 Change event namespace ordering to most-significant first [#4504 state:resolved]
More work still needs to be done on some of these names
(render_template.action_view and render_template!.action_view particularly)
but this allows (for example) /^sql/ to subscribe to all
the various ORMs without further modification

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-02 22:45:54 +02:00
Justin George
109d3ee38d Make notifications go off even when an error is raised, so that we capture the underlying performance data [#4505 state:resolved]
This is important when trying to keep track of many layers of interrelated calls

i.e.:

ActiveRecord::Base.transaction do
  MyModel.find(1) #ActiveRecord::NotFound
end # should capture the full time until the error propagation

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-02 22:45:53 +02:00
Santiago Pastorino
02028e529c Missing require added make pass activesupport/test/json/encoding_test.rb in isolation
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-05-02 22:05:40 +02:00
Xavier Noria
1b33a151b2 revises tests for Date.yesterday and Date.tomorrow 2010-05-02 01:36:10 +02:00
Xavier Noria
7aaabea517 let Date.yesterday and Date.tomorrow be based on Date.current rather than Date.today 2010-05-02 01:12:31 +02:00
José Valim
a61a6d206b Speed up I18n helpers in views and add entry to CHANGELOG. 2010-05-01 22:38:57 +02:00
Marius Nuennerich
35598db01a repair the activesupport message encryptor tests for me, do so in the same way as jeremy did with message verifier
[#4517 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-01 10:04:01 -07:00
José Valim
6b559474fb Depend on the I18n 0.4.0.beta. 2010-04-30 16:22:18 +02:00
Norman Clarke
f0e754e713 Delegate Inflector.transliterate to i18n. [#4508 state:resolved]
Ancillary changes: Moved Chars#normalize into a class method; removed
unused UTF_PAT constant.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-30 16:18:12 +02:00
José Valim
2e9af3638d Move several configuration values from Hash to ActiveSupport::XmlMini, which both Hash and Array depends on.
Also, refactored ActiveModel serializers to just use ActiveSupport::XmlMini.to_tag. As consequence, if a serialized attribute is an array or a hash, it's not encoded as yaml, but as a hash or array.
2010-04-29 12:42:42 +02:00
Neeraj Singh
580dd3b052 array.to_xml should be able to handle all types of data elements [#4490 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-29 09:04:34 +02:00
José Valim
1b816d5024 The rake task :environment now loads config/environment.rb instead of initializing the application on its own. This fixes [#4492 state:resolved] and also avoids the application being initialized twice in some rake tasks. 2010-04-29 08:39:52 +02:00
Jeremy Kemper
4e75cc59e7 object_id may be negative, producing an invalid symbol. h/t Markus Schirp 2010-04-28 15:20:35 -07:00
Cezary Baginski
1067a7be52 Fix BigDecimal JSON encoding test. [#4495 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-28 09:02:03 -07:00
Brian Durand
ee51b51b60 ActiveSupport::Cache refactoring
All Caches

* Add default options to initializer that will be sent to all read, write, fetch, exist?, increment, and decrement
* Add support for the :expires_in option to fetch and write for all caches. Cache entries are stored with the create timestamp and a ttl so that expiration can be handled independently of the implementation.
* Add support for a :namespace option. This can be used to set a global prefix for cache entries.
* Deprecate expand_cache_key on ActiveSupport::Cache and move it to ActionController::Caching and ActionDispatch::Http::Cache since the logic in the method used some Rails specific environment variables and was only used by ActionPack classes. Not very DRY but there didn't seem to be a good shared spot and ActiveSupport really shouldn't be Rails specific.
* Add support for :race_condition_ttl to fetch. This setting can prevent race conditions on fetch calls where several processes try to regenerate a recently expired entry at once.
* Add support for :compress option to fetch and write which will compress any data over a configurable threshold.
* Nil values can now be stored in the cache and are distinct from cache misses for fetch.
* Easier API to create new implementations. Just need to implement the methods read_entry, write_entry, and delete_entry instead of overwriting existing methods.
* Since all cache implementations support storing objects, update the docs to state that ActiveCache::Cache::Store implementations should store objects. Keys, however, must be strings since some implementations require that.
* Increase test coverage.
* Document methods which are provided as convenience but which may not be universally available.

MemoryStore

* MemoryStore can now safely be used as the cache for single server sites.
* Make thread safe so that the default cache implementation used by Rails is thread safe. The overhead is minimal and it is still the fastest store available.
* Provide :size initialization option indicating the maximum size of the cache in memory (defaults to 32Mb).
* Add prune logic that removes the least recently used cache entries to keep the cache size from exceeding the max.
* Deprecated SynchronizedMemoryStore since it isn't needed anymore.

FileStore

* Escape key values so they will work as file names on all file systems, be consistent, and case sensitive
* Use a hash algorithm to segment the cache into sub directories so that a large cache doesn't exceed file system limits.
* FileStore can be slow so implement the LocalCache strategy to cache reads for the duration of a request.
* Add cleanup method to keep the disk from filling up with expired entries.
* Fix increment and decrement to use file system locks so they are consistent between processes.

MemCacheStore

* Support all keys. Previously keys with spaces in them would fail
* Deprecate CompressedMemCacheStore since it isn't needed anymore (use :compress => true)

[#4452 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-27 11:13:37 -07:00
Xavier Noria
1d63129eff use ordinary syntax for options to be well-formed in 1.8 2010-04-27 02:36:34 -07:00
Jeremy Kemper
c1d7327071 JSON: encode objects that don't have a native JSON representation using to_hash, if available, instead of instance_values (the old fallback) or to_s (other encoders' default). Encode BigDecimal and Regexp encode as strings to conform with other encoders. Try to transcode non-UTF-8 strings. 2010-04-26 19:55:39 -07:00
Santiago Pastorino
76d6a99364 Use explicit source encoding rather than forced UTF-8 from US-ASCII.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-26 14:45:23 -07:00
Anil Wadghule
53c13f1aca Use Config::CONFIG['host_os'] instead of RUBY_PLATFORM [#4477 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-26 11:12:52 -07:00
Cezary Baginski
490a3335d5 Action Pack: fix tests with -K*, work around Ruby 1.9.1 constant lookup.
[#4473 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-25 17:00:20 -07:00