Commit Graph

3429 Commits

Author SHA1 Message Date
Olek Janiszewski abe915f237 Fix expanding cache key for single element arrays
In short:
expand_cache_key(element) should not equal expand_cache_key([element])

This way a fragment cache key for an index page with only a single
element in the collection is different than a fragment cache for a
typical show page for that element.
2011-12-16 17:58:25 +01:00
Aaron Patterson c24928c3ad Merge pull request #3845 from sumbach/test-return-value-from-require
Add tests for the return value of require
2011-12-04 11:22:09 -08:00
Sam Umbach cfc467f73e Simplify load and require tests
- These tests don't use autoloading so there's no need to add anything to autoload_paths
2011-12-03 13:11:02 -05:00
Sam Umbach 2a9f063082 Test that require and load raise LoadError if file not found 2011-12-03 13:08:18 -05:00
Sam Umbach 0a485309a0 Test return value of ActiveSupport::Dependencies::Loadable#load 2011-12-03 12:58:41 -05:00
Sam Umbach 93580f4936 Test return value of ActiveSupport::Dependencies::Loadable#require
- Add tests to protect from regressions in require's return value behavior
- See a10606c490 (require needs to return true or false) for the original bug fix
2011-12-03 11:52:25 -05:00
Jon Jensen 0e17cf17eb Restore performance of ERB::Util.html_escape
Revert html_escape to do a single gsub again, but add the "n" flag (no
language, i.e. not multi-byte) to protect against XSS via invalid utf8

Signed-off-by: José Valim <jose.valim@gmail.com>
2011-12-03 10:36:52 +01:00
David Heinemeier Hansson 4d20de8a50 Added Enumerable#pluck to wrap the common pattern of collect(&:method) *DHH* 2011-12-02 13:00:56 +01:00
Aaron Patterson 5b3d4f0785 switch WatchStack to use composition, tighten up API 2011-11-30 10:17:27 -08:00
José Valim 5b2eb64ceb Revert "Implement ArraySerializer and move old serialization API to a new namespace."
This reverts commit 8896b4fdc8.

Conflicts:

	activemodel/lib/active_model.rb
	activemodel/lib/active_model/serializable.rb
	activemodel/lib/active_model/serializer.rb
	activemodel/test/cases/serializer_test.rb
2011-11-30 18:48:17 +01:00
Aaron Patterson be99f0c7eb Revert "avoid hundreds of thousands of calls to (Symbol|String)#to_s"
Test coverage isn't comprehensive enough to catch what this breaks. :(
This reverts commit 45dad592e4.
2011-11-30 09:46:35 -08:00
Aaron Patterson 45dad592e4 avoid hundreds of thousands of calls to (Symbol|String)#to_s 2011-11-30 09:08:30 -08:00
José Valim 38ab982cff Log 'Filter chain halted as CALLBACKNAME rendered or redirected' every time a before callback halts. 2011-11-30 09:53:09 +01:00
Aaron Patterson d9c2882077 Module#synchronize is deprecated with no replacement. Please use `monitor` from ruby's standard library. 2011-11-29 15:40:46 -08:00
Claudio Poli 2a76f33b51 Fix typo in AS::TaggedLogging 2011-11-29 00:26:58 +01:00
Xavier Noria 152bd3c510 Revert "Used any? instead of length call"
Reason: This is slower, and any? is not equivalent in the
general case.

See discussion in https://github.com/rails/rails/pull/3779

This reverts commit 20cbf8eddc.
2011-11-28 11:07:01 +01:00
Rahul P. Chaudhari 20cbf8eddc Used any? instead of length call 2011-11-28 12:07:31 +05:30
Yehuda Katz 3c81fc3b91 Merge pull request #3767 from tadast/object_in
Object#in? also accepts multiple parameters
2011-11-26 18:10:48 -08:00
Tadas Tamošauskas ebf69ab163 Object#in? also accepts multiple parameters 2011-11-26 23:51:09 +00:00
Vijay Dev d157ca881b add more tests for monday and sunday methods 2011-11-26 23:53:57 +05:30
Arun Agrawal cd6c5677fb Tests added for monday and sunday
Reference commits : 
a8f2860d0e
80ac4dc6d0
2011-11-26 23:37:01 +05:30
Vijay Dev 80ac4dc6d0 Adds Time#sunday method 2011-11-26 23:15:11 +05:30
Vijay Dev a8f2860d0e Convert aliases monday and sunday to methods
A recent change to beginning_of_week and end_of_week added an argument
that can be used to specify the week's starting day as a symbol. Now
these methods were aliased as monday and sunday respectively which as a
consequence of the argument addition, made calls like obj.monday(:sunday)
possible. This commit makes them methods on their own.
2011-11-26 23:08:58 +05:30
Vijay Dev 99ff8fdab5 minor doc changes 2011-11-26 22:06:47 +05:30
Xavier Noria a5b362df56 some tweaks to PR#3547. [Closes #3547] 2011-11-25 12:02:49 -08:00
gregolsen 7a33a005d7 API docstrings updated with default value info 2011-11-25 12:02:49 -08:00
gregolsen 3f1a4c3415 beginning_of_week extended in both Time and Date so that to return week start based on start day that is monday by default 2011-11-25 12:02:49 -08:00
José Valim 7fcc8c0a1f Rely solely on active_model_serializer and remove the fancy constant lookup. 2011-11-23 23:45:27 +00:00
José Valim 8896b4fdc8 Implement ArraySerializer and move old serialization API to a new namespace.
The following constants were renamed:

  ActiveModel::Serialization     => ActiveModel::Serializable
  ActiveModel::Serializers::JSON => ActiveModel::Serializable::JSON
  ActiveModel::Serializers::Xml  => ActiveModel::Serializable::XML

The main motivation for such a change is that `ActiveModel::Serializers::JSON`
was not actually a serializer, but a module that when included allows the target to be serializable to JSON.

With such changes, we were able to clean up the namespace to add true serializers as the ArraySerializer.
2011-11-23 23:18:15 +00:00
José Valim 0536ea8c78 Add safe_constantize to ActiveSupport::Dependencies. 2011-11-23 21:43:03 +00:00
José Valim e62de52aa3 Merge branch 'master' into serializers 2011-11-23 20:43:06 +00:00
José Valim 3ee0116c94 Optimize cache expansion by skipping rails cache id in nested keys. 2011-11-23 18:22:09 +00:00
Olek Janiszewski a650dd05f8 Fix #3737 AS::expand_cache_key generates wrong key in certain situations (part 2)
`nil` and `false` both expand to `""` (empty string), while `true` expands to
`"true"`; `false` should expand to `"false"`
2011-11-23 18:11:38 +01:00
Olek Janiszewski d8e6dc9cf1 Fix #3737 AS::expand_cache_key generates wrong key in certain situations
`cache_key` method is never called when the argument is a 1-element array
with something that responds to `cache_key`
2011-11-23 18:06:16 +01:00
Yehuda Katz a93ee92da2 Merge pull request #3725 from marcandre/twz_eql
Fix inconsistencies with Time{WithZone}#{hash,eql?}
2011-11-22 13:01:37 -08:00
Marc-Andre Lafortune a4912078c7 Fix inconsistencies with Time{WithZone}#{hash,eql?} 2011-11-22 15:37:16 -05:00
Vijay Dev 8cae31c800 remove nodoc on OrderedHash 2011-11-22 17:12:37 +05:30
Xavier Noria 8f57bf207f tests predicates according to the boolean interpretation of their return value, not expecting specifically true or false
Respecting Genuine assert_equal false Edition
2011-11-21 14:22:16 -08:00
José Valim 401393b656 Deprecate InstanceMethods namespace handling in ActiveSupport::Concern.
This avoids the unnecessary "yo dawg, I heard you like include, so I put a module that includes your module when it is included" approach when building extensions.
2011-11-21 22:17:35 +00:00
Xavier Noria f312e2142b Revert "tests predicates according to the boolean interpretation of their return value, not expecting specifically true or false"
Reason: there were some genuine tests for false when
reading values, going to revise those ones.

This reverts commit a539a5e3f3.
2011-11-21 14:14:11 -08:00
Xavier Noria a539a5e3f3 tests predicates according to the boolean interpretation of their return value, not expecting specifically true or false 2011-11-21 14:11:40 -08:00
Xavier Noria f3554777b2 cache entry: options[:compressed] is a regular flag, no need for !! 2011-11-21 14:01:53 -08:00
Xavier Noria 91678a5b29 adds a comment to clarify an edge case 2011-11-21 13:53:40 -08:00
Xavier Noria 60e3e218c2 a couple of spurious spaces I saw in passing 2011-11-21 22:11:31 +01:00
Santiago Pastorino 4cdd44e3e0 Merge pull request #3668 from gregolsen/api_docstring_fix
updating API docstring so that user can infer default value
2011-11-19 11:52:44 -08:00
Philip Arndt e375970725 Fixed typo: expect -> expected 2011-11-18 10:17:16 +13:00
gregolsen 8d83e339fc updating API docstring so that user can infer default value 2011-11-17 22:17:33 +02:00
Vijay Dev 83bf0b626c refactor test_multiple_of 2011-11-16 02:36:36 +05:30
Vijay Dev e0efe48c45 Merge branch 'master' of github.com:lifo/docrails 2011-11-13 22:29:26 +05:30
Cheah Chu Yeow a02b40a3d2 Fix "in memory" where it should be "in-memory". 2011-11-13 13:18:55 +08:00