Commit Graph

2733 Commits

Author SHA1 Message Date
José Valim
82d41c9698 Revert "don't raise NoMethodError the tried method doesn't exists"
This reverts commit 29a5aeaae9.
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
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
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
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
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
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
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
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
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
José Valim
6b010c2690 Revert removing gsub and sub from safe buffer. 2011-09-08 20:54:30 +02: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
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
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
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