Commit Graph

3473 Commits

Author SHA1 Message Date
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 8896b4fdc8a543157cdf4dfc378607ebf6c10ab0.

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 45dad592e47944704ab6951351b2fa29d4a2385f.
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 20cbf8eddc3844126d20f1218f068889d17b0dcf.
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 : 
a8f2860d0e7db86c61bb70935006100b04667ab1
80ac4dc6d0632937ccf61b38bc15fc2f6e27b18b
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 a539a5e3f3be68f027d3dfe43f88dc9f0642c743.
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
Bogdan Gusiev
8483c7c0a6 AS::Callbacks::Callback#_compile_option refactored 2011-11-11 14:27:40 +02:00
Vijay Dev
9fd0cd3a12 Revert "Fix "in memory" where it should be "in-memory"."
This reverts commit e34e4d43301618307f94123d3710f094297f91f3.

Reason: code changes are not allowed in docrails.
2011-11-11 17:12:42 +05:30
Cheah Chu Yeow
df5c9fd9f4 Update Memcached website to its new one at http://memcached.org/. 2011-11-11 17:07:02 +08:00
Cheah Chu Yeow
e34e4d4330 Fix "in memory" where it should be "in-memory". 2011-11-11 17:04:50 +08:00
Bogdan Gusiev
08cc49b919 AS::Callbacks.__run_keyed_callback: remove unused cache 2011-11-10 16:42:27 +02:00
José Valim
80f96ebcf5 self.class.name -> self.name (we are already inside a class). 2011-11-10 08:57:09 -02:00
José Valim
c778f4e84b Merge pull request #3593 from bogdan/callbacks
AS::Callbacks._define_runner better abstraction
2011-11-10 02:50:46 -08:00
Bogdan Gusiev
bf6e29e007 AS::Callbacks#_define_runner refactored
Incapsulate the logic of keyed callback method definition and execution
in the separated method.
2011-11-10 10:25:27 +02:00
José Valim
a625523e75 Don't marshal dump twice when using encryptor. 2011-11-09 20:21:52 -02:00
José Valim
71e84a3b51 Deprecated ActiveSupport::MessageEncryptor#encrypt and decrypt. 2011-11-09 20:04:42 -02:00
Vijay Dev
f5ca190bd3 fix typo again (Thanks Phillip Oertel) 2011-11-08 10:37:06 +05:30
Aaron Patterson
6a29ea04ae Merge pull request #3549 from luckydev/rmethod
remove_method tests and changes
2011-11-07 03:02:26 -08:00
Anand
aabd61af8e added remove_method core_ext tests 2011-11-07 16:22:52 +05:30
Aaron Patterson
bcdc2c00d3 Merge pull request #3541 from dvyjones/fix-datetime-warnings
Removed argument throwing warnings when running tests
2011-11-06 19:00:07 -08:00
Henrik Hodne
9a7d916ceb Removed argument throwing warnings when running tests.
The last argument to DateTime.new/civil is the Julian day number for
when the calendar reform occured. DateTime ignores it if it's 0, and
sets it to the default of DateTime::ITALY instead, so we could just
leave it out. This also removes the warnings while running the
ActiveSupport tests (there still are some for the setup though).
2011-11-06 17:35:02 +01:00
Vijay Dev
4db1bd37cb fix typo 2011-11-06 22:03:30 +05:30
Pavan Kumar Sunkara
1934b77406 Added the test case for #3537 2011-11-06 19:22:46 +05:30
José Valim
a02bb72cf7 Merge pull request #3537 from dvyjones/refactor-pluralize-singularize
Refactored pluralize and singularize into a common method
2011-11-06 02:20:06 -08:00
Henrik Hodne
52fa34faee Refactored pluralize and singularize into a common method.
See diff discussion on rails/#3536.
2011-11-06 11:13:51 +01:00
Xavier Noria
56f16e25e9 fixes typo 2011-11-05 12:09:18 -07:00
Xavier Noria
d287e90870 implements AS::Notifications.subscribed, which provides subscriptions to events while a block runs 2011-11-05 12:02:54 -07:00
Xavier Noria
b33232f1b2 expands the documentation of AS::Notifications 2011-11-05 10:29:41 -07:00
Vijay Dev
55621504b0 make class name consistent with the filename 2011-11-05 22:31:39 +05:30
Franck Verrot
1679aa56f3 Synchronize the gemspecs since CHANGELOG has been renamed to CHANGELOG.md 2011-11-04 14:46:39 +01:00
Jon Leighton
281272ad36 Convert CHANGELOGs to Markdown format.
Reasons:

 * Markdown reads well as plain text, but can also be formatted.
 * It will make it easier for people to read on the web as Github
   formats the Markdown nicely.
 * It will encourage a level of consistency when people are writing
   CHANGELOG entries.

The script used to perform the conversion is at
https://gist.github.com/1339263
2011-11-04 12:55:17 +00:00
kennyj
7670a5187d Refactor ActiveSupport::Cache::FileStore. used method and deleted duplicate code. 2011-10-30 21:50:17 +09:00
kennyj
38da6249f0 fix a document for :compress_threshold. DEFAULT_COMPRESS_LIMIT is 16K. 2011-10-30 19:18:23 +09:00
Xavier Noria
9d1ba3755e fixes a typo (thanks to Alexey Vakhov) 2011-10-30 02:08:59 -07:00
Santiago Pastorino
75ee4d97ef Merge pull request #3464 from kennyj/avoid_to_call_twice
avoided to call `Marshal.dump` twice
2011-10-29 19:18:46 -07:00
Xavier Noria
11f6795b23 defines Module#qualified_const_(defined?|get|set) and String#deconstantize
This commit also implements a faster version of #demodulize I was unable
to isolate with git add --patch.

Not a big fan of the name #deconstantize. It complements #demodulize
getting rid of the rightmost constant, hence the name, but it is
unrelated to the well-known #constantize. So unsure. Could not come
with anything better, please feel free to rename.
2011-10-29 18:10:45 -07:00
Santiago Pastorino
8ef1bd9b29 Merge pull request #3463 from kennyj/fix_document_for_cache
fix a document for race_condition_ttl. ActiveSupport::Cache::MemoryCache isn't exist.
2011-10-29 17:53:00 -07:00
kennyj
3b546afd04 avoided to call twice 2011-10-30 03:14:35 +09:00
kennyj
7b65d12db5 fix a document for race_condition_ttl. ActiveSupport::Cache::MemoryCache isn't exist 2011-10-30 01:55:09 +09:00
kennyj
596d625c9b removed reference to SynchronizedMemoryStore and CompressedMemCacheStore (the remaining code from 9cafc28874) 2011-10-30 01:32:02 +09:00
Xavier Noria
0fc531392d let demodulize do less work, and add tests
This is also faster on 1.9.
2011-10-29 01:07:54 -07:00
José Valim
771ca79f74 Revert "Merge pull request #3395 from bdurand/fix_file_store_cleanup"
Tests were failing on Travis-CI.

This reverts commit 79d01a8f16e20c556a086a2f07e3ccb4400f9819, reversing
changes made to b838570bd69ff13d677fb43e79f10d6f3168c696.
2011-10-25 22:23:25 +02:00
Arun Agrawal
b6fc41275c Unused variable removed 2011-10-24 21:56:27 +05:30
José Valim
79d01a8f16 Merge pull request #3395 from bdurand/fix_file_store_cleanup
Fix ActiveSupport::Cache::FileStore.cleanup to actually work.
2011-10-21 12:42:06 -07:00
Brian Durand
ec93f363ca Fix ActiveSupport::Cache::FileStore.cleanup to actually work. 2011-10-21 13:28:24 -05:00
Brian Durand
d565fda5f2 Fix threading issues with BufferedLogger. 2011-10-21 12:43:52 -05:00
Arun Agrawal
c495cbcda9 Checking blank if tag might coming nil or blank
In log it should not show the empty array.
2011-10-21 16:11:09 +05:30
Vijay Dev
af1b5c54cf Merge branch 'master' of github.com:lifo/docrails 2011-10-20 23:20:44 +05:30
Martin Svalin
274c3fad50 Fixed misleading docs for String#to_formatted_s(:db) 2011-10-20 16:31:23 +02:00
José Valim
6c126015a6 Ensure TaggegLogging is thread safe. 2011-10-19 22:26:56 +02:00
David Heinemeier Hansson
18dbfcb363 Programatically define the log level methods and use the Logger constants instead (SyslogLogger didnt define them as I expected) 2011-10-19 14:54:00 -05:00
David Heinemeier Hansson
afde6fdd5e Added X-Request-Id tracking and TaggedLogging to easily log that and other production concerns 2011-10-19 12:59:33 -05:00
José Valim
59d6df5c69 Merge pull request #3151 from zenprogrammer/pluralize_without_count
Added include_count parameter to pluralize.
2011-10-17 07:02:39 -07:00
Jose and Yehuda
598fc578fb Don't unnecessarily use String eval. 2011-10-15 18:40:37 +02:00
Yasuo Honda
281b8caf80 Fixed test_nonexisting_method_with_arguments to revert commit 29a5aea 2011-10-06 07:44:48 -04:00
José Valim
82d41c9698 Revert "don't raise NoMethodError the tried method doesn't exists"
This reverts commit 29a5aeaae976bf8432d57ec996c7c81932a39de6.
2011-10-06 00:37:15 +02:00
Akira Matsuda
87eab595d8 ruby193: String#prepend is also unsafe 2011-10-05 15:26:29 +09:00
Akira Matsuda
9c4fe308b6 override unsafe methods only if defined on String 2011-10-05 15:26:28 +09:00
Ayrton De Craene
02b0f8d9ff to_formatted_s is an instance method for a Range not an Array 2011-10-04 15:21:23 +03:00
Jeremy Kemper
c10fcd2637 Merge pull request #2801 from jeremyevans/patch-1
Fix obviously breakage of Time.=== for Time subclasses
2011-10-03 10:53:09 -07:00
Christian Höltje
bb5e295d94 Rescuable spelling error 2011-10-03 10:15:31 -04:00
José Valim
1efe41dc36 Merge pull request #3174 from phuibonhoa/master
Fixed file store to handle delete_matched being called before cache dir is created.
2011-10-02 02:30:44 -07:00