Commit Graph

3429 Commits

Author SHA1 Message Date
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
Philippe Huibonhoa 119a484e80 Improved testing so that it tests the real functionality and not the private method. 2011-10-02 01:39:52 -07:00
José Valim 37b9594a8e Set the default options value for as_json in the encoder object. 2011-09-30 12:45:36 +02:00
Nicolás Hock Isaza da914fa35c Fixing `as_json` method for ActiveRecord models.
When you've got an AR Model and you override the `as_json` method,
you should be able to add default options to the renderer, like this:

    class User < ActiveRecord::Base
      def as_json(options = {})
        super(options.merge(:except => [:password_digest]))
      end
    end

This was not possible before this commit. See the added test case.
2011-09-29 21:44:23 -05:00
Philippe Huibonhoa 0baa8f8604 Added fix so that file store does not raise an exception when cache dir does not exist yet. This can happen if a delete_matched is called before anything is saved in the cache. 2011-09-29 18:59:40 -07:00
Ryan Oblak 4535191c61 Modified String#pluralize to take an optional count parameter. 2011-09-28 12:24:06 -07:00
Alexey Vakhov f916474962 remove superfluous to_s in ERB::Util.html_escape 2011-09-24 23:27:06 +04:00
Ryan Oblak 06634f44d0 Minor doc fix to String#constantize 2011-09-23 10:21:34 -07:00
José Valim 36699977f2 Update CHANGELOG for safe_constantize. 2011-09-23 16:49:05 +02:00
José Valim e8987c30d0 Use safe_constantize where possible. 2011-09-23 16:46:33 +02:00
José Valim b2f34d1e35 Ensure that constantize just rescues NameError that applies to the constant being currently loaded. 2011-09-23 16:21:49 +02:00
Ryan Oblak 310565f537 Added ActiveSupport::Inflector.safe_constantize and String#safe_constantize; refactored common constantize tests into ConstantizeTestCases 2011-09-23 15:36:33 +02:00
Santiago Pastorino 667ef57de6 No need to create a range object 2011-09-22 14:14:24 -03:00
Santiago Pastorino 855184c468 Merge pull request #3096 from phuibonhoa/master
FileStore key_file_path does not properly limit filenames to 255 characters
2011-09-22 10:03:54 -07:00
Philippe Huibonhoa a0352a425f Updated existing test that fails with this fix (8d63678d14). Before the fix the test was giving a false positive, because file_store.key_file_path would return an empty filename (i.e. test/tmp_cache/4D0/F4D rather than test/tmp_cache/4D0/F4D/xxxx…).
Even though the fix referenced above divides the filename into directories to prevent it from being too long, it seems that 1000 characters will always raise an error, so reducing the key size to 900).
2011-09-21 21:03:59 -07:00
Philippe Huibonhoa 8d63678d14 Fixed issue in file store where it could create a filename that was too long for the file system. (https://github.com/rails/rails/issues/3072) 2011-09-21 21:00:46 -07:00
Vijay Dev 8aa537c945 fix incorrect comment 2011-09-22 02:13:04 +05:30
brainopia 8e3d26733b Fix test to reflect use of to_param for keys 2011-09-18 23:37:27 +04:00
Santiago Pastorino cb0dbe35b8 Merge pull request #3049 from brainopia/fix_to_query_edge_case
Fix Hash#to_query edge case with html_safe string on 1.8 ruby
2011-09-17 17:15:33 -07:00
Santiago Pastorino 18116791d0 Proper lines numbers for stack trace info 2011-09-16 17:28:52 -07:00
brainopia 3a04e370e4 Fix Hash#to_query edge case with html_safe string on 1.8 ruby 2011-09-16 22:59:16 +04:00
Claudio Poli b0ae34ad72 Fix typo in deprecation notice 2011-09-16 19:54:48 +03:00
Peter Suschlik c9aac2a215 Fix typo in deprecation warning. 2011-09-16 09:08:53 +03:00
Willem van Bergen 6d520803ee Test deprecation warning when not using an options hash as second parameter. 2011-09-15 15:51:30 -04:00
Willem van Bergen 41fea03342 Use an options hash to specify digest/cipher algorithm and a serializer for MessageVerifier and MessageEncryptor. 2011-09-15 14:27:12 -04:00
Willem van Bergen 2d30d4cb88 Add some documentation for the new serializer property of MessageVerifier and MessageEncryptor. 2011-09-15 13:23:08 -04:00
Willem van Bergen db040cdf8b Implement API suggestions of pull request. 2011-09-15 13:15:21 -04:00
Willem van Bergen a8aaef6762 Fixed tests so that they will also run properly in other timezones. 2011-09-15 09:50:39 -04:00
Willem van Bergen bffaa888ac Custom serializers and deserializers in MessageVerifier and MessageEncryptor.
By default, these classes use Marshal for serializing and deserializing messages. Unfortunately, the Marshal format is closely associated with Ruby internals and even changes between different interpreters. This makes the resulting message very hard to impossible to unserialize messages generated by these classes in other environments like node.js.

This patch solves this by allowing you to set your own custom serializer and deserializer lambda functions. By default, it still uses Marshal to be backwards compatible.
2011-09-15 08:28:53 -04:00
Vijay Dev 823e16f57c update 3.1 release date in changelogs 2011-09-14 22:46:12 +05:30
Semyon Perepelitsa 21b4244d41 Fix a typo in date 2011-09-12 20:53:10 +04:00
Vijay Dev e05d4cea69 revert the changes from c60995f3 - related to marking sub,gsub as unavailable to use with safe strings 2011-09-09 01:05:07 +05:30
Xavier Noria 9987f1e34d delete the CHANGELOG entry re SafeBuffer and sub/gsub, since it has been reverted 2011-09-08 21:28:17 +02:00
José Valim 6b010c2690 Revert removing gsub and sub from safe buffer. 2011-09-08 20:54:30 +02:00
Xavier Noria d1d51077d5 mention the issue number for future reference 2011-09-08 05:22:02 -07:00
Xavier Noria fb84450209 registers removal of sub and friends for safe strings in the CHANGELOG 2011-09-08 05:13:56 -07:00
Xavier Noria 827fcf453e this should have gone with the previous commit 2011-09-08 05:02:47 -07:00
Xavier Noria f7627de206 copy-edits a couple of exception messages
"Safe Buffer" should either be the constant with the class name,
or go in lower case. I've chosen to follow the same terminology
that is used in the AS core extensiong guide, "safe string",
though "safe buffer" is also used elsewhere, we should pick one.
2011-09-08 04:56:31 -07:00
Damien Mathieu c60995f31d better method documentation on disable safe string methods 2011-09-08 11:27:31 +02:00
Damien Mathieu 3718ccd2a6 remove support of symbols on classify and camelize 2011-09-08 10:22:21 +02:00
Damien Mathieu e9f48cdcf4 make gsub and sub unavailable in SafeBuffers - Closes #1555 2011-09-08 10:22:21 +02:00
Jeremy Evans da8f00a55c Add tests for fixes to Time.=== 2011-09-07 10:09:04 -07:00
Tim Lucas 2147f35df2 Make sure require_tzinfo only calls Kernel#require if TZInfo isn't already present.
This wasn't a problem when require_tzinfo was only called from TimeZone#initialize, but now it's being called for every lookup to TimeZone.[] (via lazy_zones_map)

TimeZone lookup can occur when unmarshalling TimeWithZone objects, which is where I first saw the big slowdown (500ms for each Rails action that loaded from Rails.cache)
2011-09-07 14:21:18 +03:00
Arun Agrawal fc5e3ff1ba We can't simply check the first line of the backtrace,
because JRuby reports the call to __send__ in the backtrace.
2011-09-04 15:33:58 +05:30
Arun Agrawal a6c60222c5 Modified content in guides and comments
for "assert /" warnings.
Removed because if somebody will use this code
they will get warnings!
2011-09-04 08:24:02 +05:30
José Valim d50c0acc95 Merge pull request #2827 from sikachu/extractable_ordered_hash
Make `ActiveSupport::OrderedHash` extractable when using `Array#extract_options!
2011-09-03 01:25:44 -07:00
Prem Sichanugrist 9984266c04 Make `ActiveSupport::OrderedHash` extractable when using `Array#extract_options!`
`ActiveSupport::OrderedHash` is actually a subclass of the hash, so it does make sense that it should be extractable from the array list.
2011-09-03 14:43:33 +07:00
Jeremy Evans 1ebf84ac2e Edited activesupport/lib/active_support/core_ext/time/calculations.rb via GitHub 2011-09-01 11:49:49 -07:00
Vijay Dev 752d74f952 docs formatting changes 2011-09-01 20:30:45 +05:30
Chris Griego 508f33f35c Revert "Ruby 1.8.7+ provides to_date/to_datetime, AS just makes them public." to support date implementations without private to_date/to_datetime on Time (home_run).
This reverts commit 080345baca.

Signed-off-by: José Valim <jose.valim@gmail.com>
2011-08-31 19:21:55 +02:00
Santiago Pastorino 734792aaaa Merge pull request #2723 from guilleiguaran/3-1-0-changelogs
Update changelogs for Rails 3.1.0
2011-08-28 20:42:12 -03:00
Jon Leighton 8ba491acc3 Revert all the stuff to do with disallowing non-public methods for Module#delegate 2011-08-25 22:30:42 +01:00
Aaron Patterson b907271b4b stop circular require warnings 2011-08-24 16:47:01 -07:00
Aaron Patterson bac5da3ccc only backport the to_d method if it does not exist 2011-08-24 16:33:49 -07:00
Aaron Patterson 44f07098fe dealing with some -w warnings on startup 2011-08-24 13:25:11 -07:00
Jonathan del Strother e0714ee005 Fix autoload_once_paths when using Pathnames & ruby 1.9
Under ruby 1.9.2 -
  "/var/log".starts_with?(Pathname.new("/var"))  # => false

so setting config.autoload_once_paths with Pathnames would not work
2011-08-24 18:14:25 +01:00
Aaron Patterson 29004de1a2 `load` should also return the value from `super` 2011-08-23 17:04:05 -07:00
Aaron Patterson a10606c490 require needs to return true or false. thank you Ryan "zenspider" Davis 2011-08-23 16:55:43 -07:00
Daniel Schierbeck cacdbb9437 Remove trailing whitespace 2011-08-23 12:39:07 +02:00
Aaron Patterson bfc432574d properly escape html to avoid invalid utf8 causing XSS attacks 2011-08-16 15:24:58 -07:00
Xavier Noria 0245792c83 Merge branch 'master' of github.com:lifo/docrails 2011-08-16 11:06:40 -07:00
Xavier Noria d0d25a9317 prefer ends_with? over slicing 2011-08-16 10:49:20 -07:00
Jon Leighton 0d3615f04c Fix tzinfo require (it broke test_raises_when_an_invalid_timezone_is_defined_in_the_config in railties) 2011-08-16 02:42:30 +01:00
Jon Leighton bfb9e61a9f Be more lazy about creating time zone objects. Decreases startup time by about 10%. (#734) 2011-08-16 01:33:34 +01:00
Sebastian Martinez 308595739c Document Hash#extract!. 2011-08-15 20:20:28 -03:00
David Heinemeier Hansson 9482554f31 Added Array#prepend as an alias for Array#unshift and Array#append as an alias for Array#<< [DHH] 2011-08-15 16:56:33 -05:00
Arun Agrawal 83eec4ca4c Requiring delegate. 2011-08-16 01:36:21 +05:30
Jon Leighton b2469283a7 Removing unnecessary require, solve 'circular require considered harmful' warning. 2011-08-16 01:32:52 +05:30
Jon Leighton c80876f778 Document Object#public_send 2011-08-15 16:26:37 +01:00
Jon Leighton 2e2f3f5a46 Add a test for delegating a method ending in '=' as this is a special case. 2011-08-15 16:07:49 +01:00
Arun Agrawal 10b99f2826 Need to include public_send 2011-08-15 19:13:25 +05:30
Jon Leighton 27da0c5480 Split up the definitions in Module#delegate depending on :allow_nil, and don't use exceptions for flow control in the :allow_nil => true case. 2011-08-15 13:56:04 +01:00
Jon Leighton 63d100ea35 Fix the line number in the backtrace when Module#delegate raises 2011-08-15 13:03:28 +01:00
Jon Leighton 8bba95f293 Just do the method call directly in Module#delegate, if we can (we cannot for method names ending in '='). Two reasons: 1) it's faster, see https://gist.github.com/1089783 and 2) more importantly, delegate should not allow you to accidentally call private or protected methods. 2011-08-15 12:38:38 +01:00
Jon Leighton 6f4b405250 Backport Object#public_send to 1.8 so that we can implement Module#delegate such that non-public methods raise 2011-08-15 12:08:23 +01:00
Xavier Noria bf2b9d2de3 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	RELEASING_RAILS.rdoc
	actionpack/lib/sprockets/railtie.rb
	actionpack/test/template/sprockets_helper_test.rb
	activerecord/test/cases/calculations_test.rb
	railties/guides/source/3_1_release_notes.textile
	railties/guides/source/active_resource_basics.textile
	railties/guides/source/command_line.textile
2011-08-13 16:30:07 -07:00
Sukeerthi Adiga b905f8c963 Rubygems => RubyGems 2011-08-13 16:22:31 -07:00
Aaron Patterson a7a3169cc3 fixing assert_difference issues on ruby 1.8 2011-08-13 16:22:29 -07:00
Aaron Patterson eaee18dd9a make assert_difference error message not suck 2011-08-13 16:22:28 -07:00
Brian Durand 05d4b9d2fd Pass options in ActiveSupport::Cache::CacheStore#read_multi through to the delete_entry call. 2011-08-13 16:22:27 -07:00
Dmitriy Kiriyenko cc78a8f04c Remove unnecessary require (happened after fcbde454f6) 2011-08-13 16:22:27 -07:00
Arun Agrawal 30ef55de66 Removing extra requires from the test. Already loaded in abstract_unit. 2011-08-13 16:22:26 -07:00
Brad Ediger e1b546464e remove_possible_method: test if method exists
This speeds up remove_possible_method substantially since it doesn't
have to rescue a NameError in the common case.

Closes #2346.
2011-08-13 16:22:25 -07:00
Brian Durand 48fce08bb3 Change ActiveSupport::Cache behavior to always return duplicate objects instead of frozen objects. 2011-08-13 16:22:24 -07:00
Aaron Patterson f85b966269 delay backtrace scrubbing until we actually raise an exception. fixes #1936 2011-08-13 16:22:24 -07:00
Brian Cardarella 9d5340e709 Reset @dirty to false when slicing an instance of SafeBuffer 2011-08-13 16:22:24 -07:00
Jonathan del Strother ab422b04a2 Replace unnecessary regexp in Dependencies#load_missing_constant 2011-08-13 16:22:19 -07:00
Jonathan del Strother f1403f9303 Constantize a regexp in Dependencies#load_missing_constant 2011-08-13 16:22:19 -07:00
Vishnu Atrai d13b5d4b2a remove unused variables warnings removed 2011-08-13 16:22:18 -07:00
Aaron Patterson 797d2254d7 fixing tests on ruby trunk 2011-08-13 16:22:17 -07:00
Aaron Patterson 7934ffe5e9 fixing whitespace errors 2011-08-13 16:22:17 -07:00
Rashmi Yadav 111347f0cc The trailing '/' isn't being picked up by Github anyway, and the link works as is. 2011-08-13 16:22:15 -07:00
Aaron Patterson 681bf1fc48 backporting IO#binread for 1.8 users 2011-08-08 19:48:12 -07:00
Gregg Pollack 554232e481 Added irregular zombie inflection, so zombies no longer gets singularized into zomby 2011-08-07 14:20:03 -04:00
Santiago Pastorino 7ba95bf747 Merge pull request #2450 from guilleiguaran/activesupport-gzip-1.8
Fix ActiveSupport::Gzip under Ruby 1.8.7. Closes #2416
2011-08-06 13:18:51 -07:00
Guillermo Iguaran aed9917094 Fix ActiveSupport::Gzip under Ruby 1.8.7. Closes #2416 2011-08-06 11:33:18 -05:00
Evan Light b642922496 Refactored to more closely resemble idiom applied for on_nil 2011-08-05 22:06:47 -04:00
Guillermo Iguaran 780ee36c56 Fix AR test suite error under Rubinius 2.0 2011-08-05 13:20:18 -05:00
Rashmi Yadav 681d919e48 The trailing '/' isn't being picked up by Github anyway, and the link works as is. 2011-08-04 16:41:31 -07:00
Aaron Patterson 2d2c9179ad fixing assert_difference issues on ruby 1.8 2011-08-04 14:07:40 -07:00
Aaron Patterson 171881f610 make assert_difference error message not suck 2011-08-03 16:55:00 -07:00
Santiago Pastorino 6e701e8735 Merge pull request #2393 from bdurand/fix_cache_read_multi
Fix ArgumentError in ActiveSupport::Cache::CacheStore.read_multi
2011-08-01 10:58:48 -07:00
Brian Durand fec4c5ad76 Pass options in ActiveSupport::Cache::CacheStore#read_multi through to the delete_entry call. 2011-08-01 12:05:29 -05:00
Dmitriy Kiriyenko 6244a53a07 Remove unnecessary require (happened after fcbde454f6) 2011-08-01 18:00:41 +03:00
Arun Agrawal ec7457ed2a Removing extra requires from the test. Already loaded in abstract_unit. 2011-07-31 23:36:21 +05:30
Brad Ediger 7f88539087 remove_possible_method: test if method exists
This speeds up remove_possible_method substantially since it doesn't
have to rescue a NameError in the common case.

Closes #2346.
2011-07-31 08:51:48 -05:00
Aaron Patterson ae1e70cf80 Merge pull request #2353 from bdurand/no_freeze_cache_entries
Change ActiveSupport::Cache behavior to not return frozen objects
2011-07-29 16:20:21 -07:00
Brian Durand a263f37797 Change ActiveSupport::Cache behavior to always return duplicate objects instead of frozen objects. 2011-07-29 17:27:45 -05:00
Aaron Patterson ea7f50863d delay backtrace scrubbing until we actually raise an exception. fixes #1936 2011-07-29 14:38:57 -07:00
Brian Cardarella 6ef1079e0e Reset @dirty to false when slicing an instance of SafeBuffer 2011-07-29 13:10:31 -04:00
Aaron Patterson e4a7b23d38 Merge pull request #2291 from jdelStrother/load_missing_constant
Replace unnecessary regexp in Dependencies#load_missing_constant
2011-07-26 16:19:48 -07:00
Jonathan del Strother 43ef635b95 Replace unnecessary regexp in Dependencies#load_missing_constant 2011-07-27 00:06:19 +01:00
Santiago Pastorino 6089ecf931 Merge pull request #2279 from jdelStrother/load_missing_constant
Constantize a regexp in Dependencies#load_missing_constant
2011-07-26 15:23:11 -07:00
Vishnu Atrai db34a65277 remove unused variables warnings removed 2011-07-26 23:53:54 +05:30
Aaron Patterson 64807b964f fixing tests on ruby trunk 2011-07-26 11:02:41 -07:00
Aaron Patterson d4246e5bb3 fixing whitespace errors 2011-07-26 11:00:33 -07:00
Jonathan del Strother f17ea60f98 Constantize a regexp in Dependencies#load_missing_constant 2011-07-26 16:10:55 +01:00
thedarkone 624b118616 Use shorter class-level File methods instead of going through File.stat. 2011-07-25 17:02:28 +02:00
Xavier Noria 4bb0a8bcbd Merge branch 'master' of git://github.com/lifo/docrails 2011-07-24 21:02:51 +02:00
Mitesh Jain 2c90568a06 Duplicable test is looking fine now. 2011-07-24 19:43:42 +05:30
Oemuer Oezkir 71d18ce48e Changed a few instances of of words in the API docs written in British English to
American English(according to Weber)
2011-07-24 10:21:42 +00:00
Aaron Patterson cdc4274931 simplify singleton_class? method 2011-07-23 20:02:03 -07:00
Gonzalo Rodriguez 49b0f9e395 Fix ActiveSupport::Cache::FileStore#file_path_key does not work if initialized with Pathname
Port from 3-1-stable
2011-07-23 17:57:04 -03:00
Guillermo Iguaran 3fe32c3554 Remove unneccesary map chaining 2011-07-23 15:21:39 -05:00
Marc-Andre Lafortune f061ffd9f4 Trivial optimization for Enumerable#each_with_object 2011-07-23 15:52:38 -04:00
Marc-Andre Lafortune 816abecf90 Insure that Enumerable#index_by, group_by, ... return Enumerators 2011-07-23 15:52:37 -04:00
Marc-Andre Lafortune c785038839 Make Enumerable#many? iterate only over what is necessary 2011-07-23 15:52:37 -04:00
Marc-Andre Lafortune a96e824c53 Make Enumerable#many? not rely on #size 2011-07-23 15:52:37 -04:00
Marc-Andre Lafortune f6ac022a6f Test using generic Enumerables instead of arrays. 2011-07-23 15:52:37 -04:00
Marc-Andre Lafortune 0b5386f422 Make tests more precise 2011-07-23 15:52:37 -04:00
Xavier Noria d352e0dff2 checked all .rb files in the project tree for missing magic comments, one was missing
Came with this one-liner for this:

    find . -name '*.rb' | \
    xargs chardet | \
    grep -v ascii | \
    cut -d: -f1 -s | \
    xargs -n1 ruby -0777 -ne 'puts $FILENAME if $_ !~ /#.*coding:\s*utf/i'

Welcome $_.
2011-07-23 14:50:29 +02:00
Xavier Noria 4d8aaff4ea adds a couple of missing magic comments [fixes #1374] 2011-07-23 14:15:00 +02:00
Xavier Noria ace3723d2f Merge branch 'master' of git://github.com/lifo/docrails 2011-07-23 12:15:41 +02:00
Xavier Noria e175117eaf registers the changes to String#blank? in the CHANGELOG 2011-07-20 12:17:37 +02:00
Damien Mathieu 2a371368c9 missing require of string/encoding to have access to encoding_aware? 2011-07-20 11:45:59 +02:00
Xavier Noria af561901a0 Merge pull request #2146 from dmathieu/blank_binary_encoding
fix String#blank? on binary strings
2011-07-20 02:38:26 -07:00
Damien Mathieu 0c58f39c2c fix String#blank? on binary strings. 2011-07-20 11:23:00 +02:00
Josh Kalderimis 322393f8cb Changed the year of a date used in a test which fails when using 1.8.7 on a 32bit machine (ArgumentError: time out of range) 2011-07-19 13:52:32 -07:00
Jon Leighton fcbde454f6 Don't do remove_possible_method when delegate is used. Two reasons: 1) warnings should be shown, and fixed at the source and 2) the code is slow. Fixes #1937. 2011-07-18 00:22:26 +01:00
Akira Matsuda 99d598a131 need magic comments 2011-07-14 12:39:34 +09:00
Akira Matsuda 9c60860322 treat fullwidth whitespace as a blank character 2011-07-14 07:48:39 +09:00
Akira Matsuda c7359e3267 documentation fix: wrong result 2011-07-13 18:29:45 +09:00
José Valim 133a20354e Merge pull request #1756 from shtirlic/xmlschema_fix
Fix xmlschema output with fraction_digits >0
2011-07-11 10:00:28 -07:00
Xavier Noria 91bba21815 Merge pull request #2032 from dziulius/master
#many? - uses count instead of select
2011-07-11 08:36:15 -07:00
shtirlic c2b79c011f Fix xmlschema output with fraction_digits >0
Current implementation produce incorrect output when Time#usec returns
integer < 100000, because to_s doesn't add leading zeros.
2011-07-11 18:41:04 +04:00