Commit Graph

615 Commits

Author SHA1 Message Date
Rafael Mendonça França
decd719711 Merge pull request #10887 from sakuro/deep_transform_keys_in_nested_arrays
Hash#deep_*_keys(!) recurse into nested arrays.

Conflicts:
	activesupport/CHANGELOG.md
2014-05-20 21:49:58 -03:00
Vladimir Yarotsky
6cc5a86a54 Fix confusing exception in ActiveSupport delegation 2014-05-20 08:10:40 -07:00
Rafael Mendonça França
fd119467b6 Merge pull request #15037 from roccoblues/fix_duplicate_activesupport_subscribers
Fixed duplicate subscribers in ActiveSupport::Subscriber

Conflicts:
	activesupport/CHANGELOG.md
2014-05-16 21:13:34 -03:00
Yves Senn
8109dc8067 formatting pass through CHANGELOGS. [ci skip] 2014-05-16 09:03:26 +02:00
eileencodes
b342d2baef remove deprecation warning
This deprecation was released in 4.1.0 and can be removed for 4.2.0,
deprecation message / handling is no longer necessary.
2014-05-13 19:51:57 -04:00
Mark J. Titorenko
9c8242ee6a Use block parameter rather than $1 during gsub! so ActiveSupport::SafeBuffer values aren't mangled.
Fixes #15064
2014-05-12 17:13:19 +01:00
Ulysse Carion
0e909cd307 Make TimeZone#parse behave more like Time#parse.
Namely, if the mday is omitted but any other upper components are, then instead
of supplying the mday from the current time, it defaults to 1.
2014-05-11 15:04:49 +01:00
Dennis Schoen
b50468d13d Fixed duplicate subscribers in ActiveSupport::Subscriber
ActiveSupport::Subscriber no longer creates multiple subscribers when
you redefine a method.
2014-05-09 11:16:18 +02:00
Xavier Noria
daaa21bc7d several enhancements to humanize [closes #12288]
* Strips leading underscores.
* Changes some unnecessary gsub!s to sub!s.
* Replaces some anchors ^, $ with \A, \z.
* Documents that human inflection rules are applied.
* Documents that words are downcased except acronyms.
* Adds an example with an acronym.
* Rewords docs.
2014-05-06 21:35:40 +02:00
Rafael Mendonça França
d65ab433ae Improve CHANGELOG [ci skip] 2014-05-04 18:35:04 -03:00
Bogdan Gusiev
41bbac6ff4 [Fixes #14948] Hash#to_query: Changed a way how empty hash and empty array are serialized
Empty Hash or Array should not present in serialization result

    {a: []}.to_query # => ""
    {a: {}}.to_query # => ""

For more info see #14948.
2014-05-03 07:40:50 +03:00
Rafael Mendonça França
085ce4f141 Merge branch 'master' into rm-uuid-fixtures
Conflicts:
	activerecord/CHANGELOG.md
	activesupport/CHANGELOG.md
2014-04-10 15:34:55 -03:00
Emily Dobervich
5aeb3cd3ac Fixed problem where 1.day.eql?(1.day) is false
This fixes:
    1.second.eql?(1.second) #=> false

The new `eql?` requires that `other` is an `ActiveSupport::Duration`.
This requirement makes `ActiveSupport::Duration`'s behavior consistent
with other numeric types in Ruby.

    1.eql?(1.0) #=> false
    1.0.eql?(1) #=> false

    1.second.eql?(1) #=> false (was true)
    1.eql?(1.second) #=> false

    { 1 => "foo", 1.0 => "bar" }
    #=> { 1 => "foo", 1.0 => "bar" }

    { 1 => "foo", 1.second => "bar" }
    # now => { 1 => "foo", 1.second => "bar" }
    # was => { 1 => "bar" }

And though the behavior here hasn't changed, for reference:

    1 == 1.0 #=> true
    1.0 == 1 #=> true

    1 == 1.second #=> true
    1.second == 1 #=> true
2014-04-08 16:24:35 -07:00
Rafael Mendonça França
54d8c81fef Merge pull request #12016 from roderickvd/uuid_fixes
Auto-generate stable fixture UUIDs on PostgreSQL

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/fixtures.rb
	activerecord/test/cases/adapters/postgresql/uuid_test.rb
	activesupport/CHANGELOG.md
2014-04-04 12:52:49 -03:00
Pavel Pravosud
6df507e884 Make AS::SafeBuffer#prepend act like String#prepend
Make `#prepend` method modify instance in-place and return self
instead of just returning modified value. That is exactly what
`#prepend!` method was doing previously, so it's deprecated from
now on.
2014-03-31 22:33:53 -04:00
Peter Jaros
03f35a27dc HashWithIndifferentAccess better respects #to_hash
In particular, `.new`, `#update`, `#merge`, `#replace` all accept
objects which respond to `#to_hash`, even if those objects are not
Hashes directly.
2014-03-28 10:25:06 -04:00
Akshay Vishnoi
41548df342 Deprecate Class#superclass_delegating_accessor 2014-03-20 18:29:09 +05:30
Sammy Larbi
d75eeadf74 Fix #to_json for BasicObject Enumerables 2014-03-14 16:55:34 -05:00
Godfrey Chan
ccf8f27ddd Revert "Merge pull request #14269 from arthurnn/expanded_key_array"
This reverts commit 475c96589ca65282e1a61350271c2f83f0d4044f, reversing
changes made to 705915ab5cf24430892107764b0050c07e1df583.

We decided that this is not worth busting everyone's cache as this
seems like a very unlikely problem. The problem only occurs when the
user is 1) not using a namespace, or 2) using the same namesapce for
different *kinds* of cache items. The recommended "fix" is to put
those cache items into their own namspace:

    id = 1
    Rails.cache.fetch(id, namespace: "user"){ User.find(id) }

    ids = [1]
    Rails.cache.fetch(ids, namespace: "users"){ User.find(ids) }

See the discussion on #14269 for details.
2014-03-04 17:58:58 -08:00
Arthur Neves
7d98247446
Cache key should be different when is Array.
`cache.fetch(['foo'])` and `cache.fetch('foo')` should generate
different cache keys as they are not equivalents.

[related #8615]
[related #8614]
2014-03-03 21:00:15 -05:00
Parker Selbert
c046e60965 Return a hash rather than array from fetch_multi
The current implementation of `fetch_multi` returns an array and has no
means to easily backtrack which names yielded which results. By changing
the return value to a Hash we retain the name information. Hash#values
can be used on the response if only the values are needed.
2014-02-26 20:31:46 -06:00
Carlos Antonio da Silva
71b3910a7d Point master changelogs to 4-1-stable branch
Remove 4-1 related entries from master [ci skip]
2014-02-25 09:14:36 -03:00
David Heinemeier Hansson
d61baee52a Go with #presence_in instead of #present_in -- it doesnt sound quite as good, but the closer relationship to #presence over #present is ultimately worth it 2014-02-24 14:17:47 +01:00
Jeremy Kemper
b16c36e688 Introduce Concern#class_methods and Kernel#concern 2014-02-23 12:06:23 -07:00
Carlos Antonio da Silva
68345d4a1a Move changelog entry to the top, fix examples indent [ci skip] 2014-02-18 12:53:01 -03:00
David Heinemeier Hansson
4edca106da Added Object#present_in to simplify value whitelisting 2014-02-18 16:35:07 +01:00
Xavier Noria
65a7c57105 time helpers honor the application time zone when passed a date
Rails applications are expected to be always aware of the application
time zone.

To be consistent with that contract, we have to assume that a bare
date passed to time helpers is a date in the application time zone,
not in the system time zone. The system time zone is irrelevant, we
should totally ignore it.

For example,

    travel_to user.birth_date + 40.years

should make that user be 40th years old regardless of the system
time zone. Without this patch that may not be true.
2014-02-18 09:42:06 +01:00
Justin Coyne
ae28e4beb3 Fix tidy_bytes for JRuby
The previous implementation was broken because JRuby (1.7.10) doesn't
have a code converter for UTF-8 to UTF8-MAC.
2014-02-10 08:10:44 -06:00
Yves Senn
580f0b61dc synchronize 4.1 release notes with CHANGELOGS. [ci skip]
/cc @chancancode
2014-02-06 11:43:16 +01:00
Rafael Mendonça França
7aa4b7dc6b Add CHANGELOG entry
Closes #13909
2014-02-05 23:55:50 -02:00
Rafael Mendonça França
a60ccadbf0 Merge pull request #13911 from davidcelis/remove-bigdecimal-serialization
Deprecate custom BigDecimal serialization

Conflicts:
	activesupport/CHANGELOG.md
2014-02-01 18:03:21 -02:00
David Celis
85d820b169 Don't require BigDecimal serialization extension
Rails currently provides an extension to BigDecimal that redefines how
it is serialized to YAML. However, as noted in #12467, this does not
work as expected. When ActiveSupport is required, BigDecimal YAML
serialization does not maintain the object type. It instead ends up
serializing the number represented by the BigDecimal itself which, when
loaded by YAML later, becomes a Float:

```ruby
require 'yaml'
require 'bigdecimal'

yaml = BigDecimal('13.37').to_yaml
YAML.load(yaml).class

require 'active_support/all'

yaml = BigDecimal('13.37').to_yaml
YAML.load(yaml).class
```

@tenderlove posits that we should deprecate the custom BigDecimal
serialization and let Ruby handle it. For the time being, users who
require this serialization for backwards compatibility can manually
`require 'active_support/core_ext/big_decimal/yaml_conversions'`.

This will close #12467 and deprecate the custom BigDecimal#to_yaml.

Signed-off-by: David Celis <me@davidcel.is>
2014-02-01 10:45:51 -08:00
Rafael Mendonça França
82701cd61e Merge pull request #12769 from birkirb/master
Boolean parser blows up on a Fixnum.

Conflicts:
	activesupport/CHANGELOG.md
2014-02-01 14:49:32 -02:00
Andrew White
63f8fabe49 Maintain the current timezone in wrap_with_time_zone
Extend the solution from the fix for #12163 to the general case where
`Time` methods are wrapped with a time zone.

Fixes #12596.
2014-01-31 17:13:12 +00:00
Rafael Mendonça França
7abb6e00c0 Remove automatic removal of Date/Time stubs after each test case
This behavior is only work out-of-box with minitest and also add a
downside to run after each test case, even if we don't used the travel
or travel_to methods
2014-01-30 10:17:48 -02:00
Rafael Mendonça França
6b16c27881 Add travel_back to remove stubs from travel and travel_to 2014-01-30 10:17:47 -02:00
Yves Senn
02f9f33142 tidy CHANGELOGs [ci skip] 2014-01-30 11:12:46 +01:00
Kassio Borges
42566626e9 Fix documentation of new controller filters api [ci skip]
The api for filters with classes change and the guides weren't updated.
Now the class must respond for methods with the same name as the filter,
so the `before_action` calls a `before` method, and so on.

The method `#filter` has been deprecated in 4.0.0 and has been removed
in 4.1.0: #7560
2014-01-29 18:47:08 -02:00
Andrew White
9484f4b821 Add CHANGELOG entry for #11464 2014-01-26 21:25:54 +00:00
Andrew White
b594492870 Maintain current timezone when changing time during DST overlap
Currently if a time is changed during DST overlap in the autumn then the
method `period_for_local` will return the DST period. However if the
original time is not DST then this can be surprising and is not what is
generally wanted. This commit changes that behavior to maintain the current
period if it's in the list of periods returned by `periods_for_local`.

It is possible to alter the behavior of `period_for_local` by specifying a
second argument but since we may be change from another time that could be
either DST or not then this would give inconsistent results.

Fixes #12163.
2014-01-26 16:56:33 +00:00
tinogomes
5121593787 Adding Hash#compact and Hash#compact! methods
* Adding Hash#compact and Hash#compact! methods
  * Using Ruby 1.9 syntax on documentation
  * Updating guides for `Hash#compact` and `Hash#compact!` methods
  * Updating CHANGELOG for ActiveSupport
  * Removing unecessary protected method and lambda for `Hash#compact` implementations
  * Performing `Hash#compact` implementation - https://gist.github.com/tinogomes/8332883
  * fixing order position
  * Fixing typo
2014-01-09 16:02:55 -02:00
Roderick van Domburg
9330631888 Auto-generate stable fixture UUIDs on PostgreSQL.
Fixes: #11524
2014-01-07 19:05:50 +01:00
Carlos Antonio da Silva
6bf93b22d5 Fix typo in AS changelog, improve highlight [ci skip] 2014-01-06 10:28:44 -02:00
Yves Senn
535bd55fcd quick formatting pass through CHANGELOGS. [ci skip]. 2014-01-06 10:57:00 +01:00
Andrew White
a1564d470d Add CHANGELOG entry for #10634 [ci skip] 2014-01-05 19:23:53 +00:00
Arthur Neves
e7f56a7fe8 Raise if MemCacheStore doenst receive a Dalli obj
:mem_cache_store should receive a list of hosts or a dalli client,
otherwise raise it.
Also adding a changelog.
2014-01-03 16:39:50 -05:00
Andrew White
75ad0e642c Don't lazy load the tzinfo library
Lazy loading the tzinfo library doesn't really buy us anything because
the gem is installed as a dependency via the gemspec and if a developer
is using Active Support outside of Rails then they can cherry pick which
files to load anyway.

Fixes #13553
2014-01-01 20:29:56 +00:00
Robin Dupret
afc98eadb8 Avoid raising a NameError on FreeBSD using Date
The Date object has a xmlschema method starting with Ruby 1.9 so we were
assuming that we could safely remove this method and redefine it later
but the call to remove_method throws a NameError on FreeBSD so we should
rely on remove_possible_method instead.

This call is actually needed to avoid warnings when running the test
suite.

Fixes #11723
2014-01-01 15:29:24 +01:00
Xavier Noria
126dc47665 blank? and present? commit to return singletons [Xavier Noria & Pavel Pravosud]
The contract of blank? and present? was in principle to return Object, as we
generally do, the test suite and description was consistent with that, but some
examples had comments like "# => true".

This cannot be unclear, we either fix the examples, or update the contract.

Since users may be already assuming singletons due to the examples and the fact
that they were returned before 30ba7ee, the safest option seems to be to revise
the contract and the implementation of String#blank?

The motivation for 30ba7ee was to improve the performance of the predicate, the
refactor based on === is on par regarding speed.

With this commit we start documenting return types using YARD conventions. We
plan to document return types gradually.
2013-12-28 20:03:38 +01:00
Birkir A. Barkarson
8dd4aca485 Fix breakage in XmlMini
- Boolean parsing breaks on non strings (i.e. integer 1|0)
- Symbol parsing breaks on non strings.
- BigDecimal parsing breaks due to missing require.
- Update changelog.
2013-12-23 14:04:16 +09:00
Kenta Murata & Akira Matsuda
9e997e9039 Fix AS::NumberHelper results with large precisions
before:
  ActiveSupport::NumberHelper.number_to_rounded '3.14159', precision: 50
  => "3.14158999999999988261834005243144929409027099609375"
after:
  ActiveSupport::NumberHelper.number_to_rounded '3.14159', precision: 50
  => "3.14159000000000000000000000000000000000000000000000"
2013-12-20 16:26:35 +09:00
Yves Senn
8ac78d81b1 Merge pull request #13367 from abhishekjain16/new_branch
change to DateTime.civil_from_format from DateTime.civil_from_fromat in ...

[ci skip]
2013-12-18 01:12:08 -08:00
abhishek
29712f0cbc change to DateTime.civil_from_format from DateTime.civil_from_fromat in changelog [ci skip] 2013-12-18 14:21:10 +05:30
Carlos Antonio da Silva
8e21ae37ad Add changelog and upgrading notice related to I18n enforce_available_locales handling 2013-12-17 09:06:56 -02:00
Carlos Antonio da Silva
aaa5463cc0 Fix indent on AS changelog [ci skip] 2013-12-17 09:03:12 -02:00
Jeremy Kemper
1eee0ca6de Introduce Module#concerning
A natural, low-ceremony way to separate responsibilities within a class.

Imported from https://github.com/37signals/concerning#readme
2013-12-17 02:31:57 -07:00
Carlos Antonio da Silva
fe24f3560a Changelog improvements [ci skip] 2013-12-12 08:33:46 -02:00
Mario Visic
ffe99774bb Fix issue with Kernel#silence_stream leaking file descriptors
Calling Kernel#silence_stream creates a new file descriptor which isn't
closed after it is used. As a result calling silence_stream multiple
times leads to a build up of loose file descriptors and can cause issues
in environments where garbage collection isn't run often.
2013-12-06 10:24:06 +11:00
Yves Senn
73b57a515f set i18n.enforce_available_locales before i18n.default_locale. 2013-12-05 13:19:51 +01:00
Godfrey Chan
146e95c70d Backfilled CHANGELOG for AS::JSON::Variable removal (6f3e01e8) [ci skip] 2013-12-03 16:10:06 -08:00
Carlos Antonio da Silva
7c20a8b558 Changelog improvements [ci skip] 2013-12-03 14:38:12 -02:00
Dimko
18546d4e35 Added Date#all_week/month/quarter/year for generating date ranges 2013-12-03 20:32:20 +04:00
Colin Bartlett
029f24ede9 Add support for localized date references
Ruby's Date class automatically gives us #yesterday, #today,
and #tomorrow. And ActiveSupport has a handy Time.zone.today
for getting a localized version. But there was no localized
version of #yesterday or #tomorrow. Until now.
2013-12-03 10:37:01 -05:00
Nerian
2ebf47aea2 Modify the Hash#assert_valid_keys error message so that it shows the valid keys. Also, show the wrong value as it was entered.
{ :failore => "stuff", :funny => "business" }.assert_valid_keys([ :failure, :funny ])
=> ArgumentError: Unknown key: failore
{ 'failore' => "stuff", :funny => "business" }.assert_valid_keys([ :failure, :funny ])
=> ArgumentError: Unknown key: failore

{ 'failore' => "stuff", :funny => "business" }.assert_valid_keys([ :failure, :funny ])
=> ArgumentError: Unknown key: "failore". Valid keys are: :failure, :funny

{ :failore => "stuff", :funny => "business" }.assert_valid_keys([ :failure, :funny ])
=> ArgumentError: Unknown key: :failore. Valid keys are: :failure, :funny

Conflicts:
	activerecord/CHANGELOG.md

Closes #11624.
2013-12-03 00:12:04 -02:00
Carlos Antonio da Silva
6e905e21b1 Merge pull request #13060 from chancancode/change_log_for_json_refactor
CHANGELOG for JSON refactor + added back the `encode_big_decimal_as_string` option with warning
2013-12-02 17:47:29 -08:00
Godfrey Chan
fadc02b732 Added back the encode_big_decimal_as_string option with warning
Also added the missing CHANGELOG entry for #12183 @ 80e7552073 and
4d02296cfb.
2013-12-02 17:22:57 -08:00
Genadi Samokovarov
7dfbd91b07 Unify cattr and mattr accessors declarations 2013-12-02 23:57:20 +02:00
Yves Senn
7c6d99e81e first pass through CHANGELOGS to extract 4_1_release_notes. [ci skip]
Extract **notable changes**, **deprecations** and **removals** from
each CHANGELOG.

I tried to reference the commits and pull requests for new features
and deprecations.

In the process I also made some minor changes to the CHANGELOGS.

The 4_1_release_notes guide is declared WIP.
2013-11-28 17:24:15 +01:00
Yves Senn
0173e149b0 remove duplicate sentence from AS changelog. [ci skip]. 2013-11-28 15:43:00 +01:00
Jeremy Kemper
d4016f24fb Merge branch 'deprecate_numeric_since_ago' of https://github.com/chancancode/rails
Conflicts:
	activesupport/CHANGELOG.md
2013-11-27 03:47:35 -07:00
Godfrey Chan
1f16136049 Deprecated Numeric#{ago,until,since,from_now}
The user is expected to explicitly convert the value into an
AS::Duration, i.e. `5.ago` => `5.seconds.ago`

This will help to catch subtle bugs like:

  def recent?(days = 3)
    self.created_at >= days.ago
  end

The above code would check if the model is created within the last 3
**seconds**.

In the future, `Numeric#{ago,until,since,from_now}` should be removed
completely, or throw some sort of errors to indicate there are no
implicit conversion from `Numeric` to `AS::Duration`.

Also fixed & refactor the test cases for Numeric#{ago,since} and
AS::Duration#{ago,since}. The original test case had the assertion
flipped and the purpose of the test wasn't very clear.
2013-11-26 22:24:19 -08:00
Godfrey Chan
78cd3b0e53 Requires JSON gem version 1.7.7 or above as it contains an important
security fix.
2013-11-26 22:17:50 -08:00
Prem Sichanugrist
225cd915cf Add #travel and #travel_to to AS::TestCase
Add `ActiveSupport::Testing::TimeHelpers#travel` and `#travel_to`. These
methods change current time to the given time or time difference by
stubbing `Time.now` and `Date.today` to return the time or date after
the difference calculation, or the time or date that got passed into the
method respectively. These methods also accept a block, which will
return current time back to its original state at the end of the block.

Example for `#travel`:

    Time.now # => 2013-11-09 15:34:49 -05:00
    travel 1.day
    Time.now # => 2013-11-10 15:34:49 -05:00
    Date.today # => Sun, 10 Nov 2013

Example for `#travel_to`:

    Time.now # => 2013-11-09 15:34:49 -05:00
    travel_to Time.new(2004, 11, 24, 01, 04, 44)
    Time.now # => 2004-11-24 01:04:44 -05:00
    Date.today # => Wed, 24 Nov 2004

Both of these methods also accept a block, which will return the current
time back to its original state at the end of the block:

    Time.now # => 2013-11-09 15:34:49 -05:00

    travel 1.day do
      User.create.created_at # => Sun, 10 Nov 2013 15:34:49 EST -05:00
    end

    travel_to Time.new(2004, 11, 24, 01, 04, 44) do
      User.create.created_at # => Wed, 24 Nov 2004 01:04:44 EST -05:00
    end

    Time.now # => 2013-11-09 15:34:49 -05:00

This module is included in `ActiveSupport::TestCase` automatically.
2013-11-20 16:05:02 +07:00
Alexey Chernenkov
0e953c94b1 Unify cattr_* interface: allow to pass a block to cattr_reader.
Example:

    class A
      cattr_reader(:defr) { 'default_reader_value' }
    end
    A.defr # => 'default_reader_value'
2013-11-15 19:54:51 +06:00
Godfrey Chan
0f33d70e89 Improved compatibility with the stdlib JSON gem.
Previously, calling `::JSON.{generate,dump}` sometimes causes
unexpected failures such as intridea/multi_json#86.

`::JSON.{generate,dump}` now bypasses the ActiveSupport JSON encoder
completely and yields the same result with or without ActiveSupport.
This means that it will **not** call `as_json` and will ignore any
options that the JSON gem does not natively understand. To invoke
ActiveSupport's JSON encoder instead, use `obj.to_json(options)` or
`ActiveSupport::JSON.encode(obj, options)`.
2013-11-14 15:46:43 -08:00
Carlos Antonio da Silva
5deec016fe Improve changelogs formatting [ci skip] 2013-11-09 16:44:58 -02:00
Ryan Glover
a64d4e85e3 Standardize all JSON encoded times to use 3 decimal fractional seconds 2013-11-07 10:43:51 -05:00
Godfrey Chan
798881ecd4 Do not expose internal state in the public encoder API (i.e. as_json)
See [1] for why this is not a good idea.

As part of this refactor, circular reference protection in as_json has
been removed and the corresponding error class has been deprecated.

As discussed with @jeremy, circular reference error is considered
programmer errors and protecting against it is out of scope for
the encoder.

This is again based on the excellent work by @sergiocampama in #11728.

[1]: https://github.com/intridea/multi_json/pull/138#issuecomment-24468223
2013-11-06 17:16:11 -08:00
claudiob
c61544c781 Add +capitalize+ option to Inflector.humanize
So strings can be humanized without being capitalized:

    'employee_salary'.humanize                    # => "Employee salary"
    'employee_salary'.humanize(capitalize: false) # => "employee salary"
2013-11-06 13:03:46 -08:00
Carlos Antonio da Silva
dcee010ce8 Fix AS changelog indent, remove tabs and extra spaces [ci skip] 2013-11-06 03:09:01 -02:00
Godfrey Chan
134c1156dd Fixed Object#as_json and Struct#as_json with options
These methods now takes the same options as Hash#as_json, for example:

    struct = Struct.new(:foo, :bar).new
    struct.foo = "hello"
    struct.bar = "world"
    json = struct.as_json(only: [:foo]) # => {foo: "hello"}

This is extracted from PR #11728 from @sergiocampama, see also the
discussion in #11460.
2013-11-05 19:22:03 -08:00
David Heinemeier Hansson
423249504a Added Numeric#in_milliseconds, like 1.hour.in_milliseconds, so we can feed them to JavaScript functions like getTime(). 2013-11-02 15:40:16 -07:00
Godfrey Chan
1fb7969154 Raise an error when AS::JSON.decode is called with options
Rails 4.1 has switched away from MultiJson, and does not currently
support any options on `ActiveSupport::JSON.decode`. Passing in
unsupported options (i.e. any non-empty options hash) will now raise
an ArgumentError.

Rationale:

1. We cannot guarantee the underlying JSON parser won't change in the
   future, hence we cannot guarantee a consistent set of options the
   method could take

2. The `json` gem, which happens to be the current JSON parser, takes
   many dangerous options that is irrelevant to the purpose of AS's
   JSON decoding API

3. To reserve the options hash for future use, e.g. overriding default
   global options like ActiveSupport.parse_json_times

This change *DOES NOT* introduce any changes in the public API. The
signature of the method is still decode(json_text, options). The
difference is this method previously accepted undocumented options
which does different things when the underlying adapter changes. It
now correctly raises an ArgumentError when it encounters options that
it does not recognize (and currently it does not support any options).
2013-10-30 10:56:00 -07:00
Rafael Mendonça França
f18cf8e488 Merge pull request #11785 from grosser/grosser/file-unless-exist
support :unless_exist for FileCache

Conflicts:
	activesupport/CHANGELOG.md
	activesupport/test/caching_test.rb
2013-10-28 19:09:22 -02:00
Antonio Santos
f13fce617d slice! should not remove default hash value/proc 2013-10-24 09:17:35 +02:00
Lucas Mazza
2f1c9c8d60 Fix code blocks identation on AR and AS CHANGELOGs 2013-10-16 10:53:43 -03:00
Jeremy Kemper
365110196a Revert "Merge pull request #12480 from iwiznia/master"
This reverts commit e5f5a838b96a362534d9bb60d02334439ed9784c, reversing
changes made to d7567f3290a50952494e9213556a1f283a6cf3a0.
2013-10-11 13:05:29 -07:00
Ionatan Wiznia
90871f7198 flatten and flatten! methods for ActiveSupport::Duration 2013-10-11 12:50:23 +02:00
Xavier Noria
276956d07c registers 0b0beb7 in the CHANGELOG [ci skip] 2013-10-01 10:07:19 +02:00
Bogdan Gusiev
c31d534da5 Changelog entry for pr #11474 2013-09-23 13:15:57 +03:00
Daniel Schierbeck
d2824a347f Allow attaching to AS::Notifications namespace up front
Before, you were required to attach *after* adding the methods to the
class, since the attachment process needed the methods to be present.

With this change, any new method will also be attached to the configured
namespace.
2013-09-20 10:14:28 +02:00
Rafael Mendonça França
6827451640 Add CHANGELOG entry for #10879
[ci skip]
2013-09-12 18:34:34 -03:00
Murray Steele
accd4926cc Fix FileStore#cleanup to no longer rely on missing each_key method 2013-09-11 13:58:40 +01:00
Shay Davidson
0fb33f3fda Fixed changelog 2013-09-02 09:00:21 +03:00
grosser
c17bd7476a support :unless_exist for FileCache 2013-08-30 12:53:35 +02:00
Shay Davidson
b2ae07f0b2 Added partial days support to DateTime's advance method.
You can now add partial days (e.g. 2.5.days) to `DateTime` with the advance method.
This was acheived by mimicing the `advance` implementation in `Time`.
2013-08-30 12:21:34 +03:00
Jack Xu
24a7e60943 Enable number_to_percentage to keep the number's precision by allowing :precision to be nil
number_helper.number_to_percentage(1000, precision: nil) # => "1000%"
2013-08-28 23:46:53 -05:00
Simon Coffey
b4a9668626 Ensure all-caps nested consts marked as autoloaded
Previously, an autoloaded constant `HTML::SomeClass` would not be marked
as autoloaded by AS::Dependencies. This is because the
`#loadable_constants_for_path` method uses `String#camelize` on the
inferred file path, which in turn means that, unless otherwise directed,
AS::Dependencies watches for loaded constants in the `Html` namespace.

By passing the original qualified constant name to `#load_or_require`,
this inference step is avoided, and the new constant is picked up in the
correct namespace.
2013-08-27 08:20:33 +01:00
David Heinemeier Hansson
5da23a3f92 Add String#remove(pattern) as a short-hand for the common pattern of String#gsub(pattern, '') 2013-08-13 12:16:25 -05:00
Xavier Noria
c7ac0a5b28 renames the :abort deprecation behaviour to :raise
That is a better name, thanks @jeremy.
2013-08-13 01:44:52 +02:00
Xavier Noria
4c1454db22 fixes typo in CHANGELOG 2013-08-13 01:28:28 +02:00
Xavier Noria
73aad75f56 defines a new :abort deprecation behaviour that raises
See the CHANGELONG message in the patch for further details.
2013-08-13 01:27:18 +02:00
Joost Lubach
369a107c8e Added method #eql? to ActiveSupport::Duration, in addition to #==.
Currently, the following returns `false`, contrary to expectation:

    1.minute.eql?(1.minute)

Adding method `#eql?` will make this behave like expected. Method `#eql?` is
just a bit stricter than `#==`, as it checks whether the argument is also a
uration. Their parts may be different though.

    1.minute.eql?(60.seconds)  # => true
    1.minute.eql?(60)          # => false
2013-08-07 16:46:30 +02:00
Andrew White
0423d9c6c5 Add CHANGELOG entry for inflection removal 2013-07-30 12:00:40 +01:00
Andrew White
88c0ef4d4f Fix handling of offsets with Time#to_s(:iso8601)
Use a lambda to ensure that the generated string respects the offset of
the time value. Also add DateTime#to_s(:iso8601) and Date#to_s(:iso8601)
for completeness.
2013-07-29 12:31:20 +01:00
David Heinemeier Hansson
b67a80de9b Add Time#to_s(:iso8601) for easy conversion of times to the iso8601 format for easy Javascript date parsing 2013-07-28 16:34:43 -05:00
Carlos Antonio da Silva
68bbbd470d Move #11546 changelog to the top [ci skip] 2013-07-22 12:51:36 -03:00
Simeon Simeonov
51d9b9a821 [Fixes #11512] improves cache size calculation in ActiveSupport::Cache::MemoryStore
Previously, the cache size of `ActiveSupport::Cache::MemoryStore` was calculated
as the sum of the size of its entries, ignoring the size of keys and any data
structure overhead. This could lead to the calculated cache size sometimes being
10-100x smaller than the memory used, e.g., in the case of small values.

The size of a key/entry pair is now calculated via `#cached_size`:

    def cached_size(key, entry)
      key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD
    end

The value of `PER_ENTRY_OVERHEAD` is 240 bytes based on an [empirical
estimation](https://gist.github.com/ssimeonov/6047200) for 64-bit MRI on
1.9.3 and 2.0.

Fixes GH#11512 https://github.com/rails/rails/issues/11512
2013-07-22 09:53:03 -04:00
Andrew White
07a4c76a07 Only raise DelegationError if it's is the source of the exception
This fixes situations where nested NoMethodError exceptions are masked
by delegations. This would cause confusion especially where there was a
problem in the Rails booting process because of a delegation in the
routes reloading code.

Fixes #10559
2013-07-11 09:05:32 +01:00
Andrew White
c42260a325 Return local time for backwards compatibility 2013-07-09 15:50:14 +01:00
Andrew White
1b3873730b Retain UTC offset when using Time.at_with_coercion
The standard Ruby behavior for Time.at is to return the same type of
time when passing an instance of Time as a single argument. Since the
an ActiveSupport::TimeWithZone instance may be a different timezone than
the system timezone and DateTime just understands offsets the best we
can do is to return an instance of Time with the correct offset.

Fixes #11350.
2013-07-09 13:43:56 +01:00
Marc Schütz
20c065594f Make HashWithIndifferentAccess#select always return the hash.
Hash#select! returns nil if the hash didn't change and thus behaves differently
from select, so it's return value can't be used as result for the latter.
2013-07-06 15:56:07 +02:00
Yves Senn
19f842b5fa Revert "remove string based terminators for ActiveSupport::Callbacks."
This reverts commit d108672dada7ba97d3b3b56f0c6001cea621061e.

Conflicts:

	activesupport/CHANGELOG.md
2013-07-05 13:53:10 +02:00
Yves Senn
e94be7b04c fix typo in Active Support CHANGELOG. [ci skip] 2013-07-05 12:43:17 +02:00
Yves Senn
d108672dad remove string based terminators for ActiveSupport::Callbacks. 2013-07-05 12:41:15 +02:00
Arun Agrawal
36321d85e9 Remove deprecated String#encoding_aware?
core extensions (`core_ext/string/encoding`).
2013-07-03 19:50:19 +02:00
Arun Agrawal
c9bbac46dd Remove deprecated Module#local_constant_names
in favor of `Module#local_constants`
2013-07-03 19:42:34 +02:00
Arun Agrawal
028f91277d Remove deprecated DateTime.local_offset 2013-07-03 19:40:24 +02:00
Carlos Antonio da Silva
39475aa350 Remove deprecated Logger core extensions (core_ext/logger.rb) 2013-07-03 13:54:34 -03:00
Yves Senn
f34b3189dd Merge pull request #11265 from vipulnsward/deprecated_time_methods
Remove deprecated `Time` methods
2013-07-03 06:37:35 -07:00
Vipul A M
ec5e03bf67 Remove deprecated Time#time_with_datetime_fallback, Time#utc_time
and `Time#local_time` in favour of `Time#utc` and `Time#local`
2013-07-03 18:52:53 +05:30
Yves Senn
33c61e3265 use American English: "favor" not "favour" [ci skip]
according to http://guides.rubyonrails.org/api_documentation_guidelines.html#english
2013-07-03 11:52:52 +02:00
Carlos Antonio da Silva
01f0c3f308 Remove deprecated Hash#diff with no replacement.
If you're using it to compare hashes for the purpose of testing,
please use MiniTest's assert_equal instead.
2013-07-02 23:32:38 -03:00
Vipul A M
4bec1da79b Remove deprecated Date#to_time_in_current_zone 2013-07-02 11:22:19 +05:30
Carlos Antonio da Silva
f62fb985b6 Remove deprecated Proc#bind with no replacement. 2013-07-01 22:38:28 -03:00
Carlos Antonio da Silva
1c06bd17a9 Remove deprecated Array#uniq_by and Array#uniq_by!
Use native Array#uniq and Array#uniq! instead.
2013-07-01 22:33:42 -03:00
Carlos Antonio da Silva
cad3a13086 Remove deprecated AS::BasicObject, use AS::ProxyObject instead 2013-07-01 22:26:54 -03:00
Yves Senn
cfa35c55bb remove deprecated BufferedLogger. 2013-07-01 22:16:37 +02:00
Yves Senn
74ebc451c9 remove deprecated assert_present and assert_blank. 2013-07-01 22:06:26 +02:00
Mark J. Titorenko
a3678e45ec Fix BacktraceCleaner#noise for multiple silencers.
The previous implementation of BacktraceSilencer#noise did not
work correctly if more than one silencer was configured --
specifically, it would only return noise which was matched by all
silencers.

The new implementation is such that anything that has been matched by
silencers is removed from the backtrace using Array#- (array
difference), ie. we now return all elements within a backtrace that
have been matched by any silencer (and are thus removed by #silence).

Fixes #11030.
2013-06-20 19:54:32 +01:00
Carlos Antonio da Silva
a9a33c59f6 Fix AS changelog [ci skip] 2013-06-14 19:53:58 -03:00
Rafael Mendonça França
6e34601653 Add CHANGELOG entry for #10740
[ci skip]
2013-06-14 17:56:49 -03:00
Andrew White
17f5d8e062 Keep sub-second resolution when wrapping a DateTime value
Add `DateTime#usec` and `DateTime#nsec` so that `ActiveSupport::TimeWithZone`
keeps sub-second resolution when wrapping a `DateTime` value.

Fixes #10855
2013-06-13 12:01:12 +01:00
Andrew Kreiling
a548792aa0 Don't blindly call blame_file! on exceptions in ActiveSupport::Dependencies::Loadable
It is possible under some environments to receive an Exception that is
not extended with Blamable (e.g. JRuby).
ActiveSupport::Dependencies::Loadable#load_dependency blindly call
blame_file! on the exception which throws it's own NoMethodError
exception and hides the original Exception.

This commit fixes #9521
2013-06-09 18:20:10 -04:00
OZAWA Sakuro
ac0b1d835d Hash#deep_*_keys(!) recurse into nested arrays.
Following methods now recursively transform nested arrays, too.

* Hash#deep_transform_keys
* Hash#deep_transform_keys!
* Hash#deep_stringify_keys
* Hash#deep_stringify_keys!
* Hash#deep_symbolize_keys
* Hash#deep_symbolize_keys!
2013-06-08 18:59:56 +09:00
Andrew White
b7f9de27f0 Override Time.at to work with Time-like values
Time.at allows passing a single Time argument which is then converted
to an integer. The conversion code since 1.9.3r429 explicitly checks
for an instance of Time so we need to override it to allow DateTime
and ActiveSupport::TimeWithZone values.
2013-06-08 09:50:15 +01:00
Yves Senn
c44a929f49 Prevent side effects in Hash#with_indifferent_access. 2013-05-29 08:43:35 +02:00
Mike Dillon
2d7a86e179 Raise when multiple included blocks are defined 2013-05-16 11:28:31 -07:00
Rafael Mendonça França
0854ba149a Fix typo: require -> requires
[ci skip]
2013-05-12 15:16:32 -03:00
Rafael Mendonça França
bf8fa7c5c7 Add CHANGELOG entry for #10576
[ci skip]
2013-05-12 15:04:05 -03:00
Rafael Mendonça França
9d6a5b4432 Give credits to all the envolved people [ci skip] 2013-05-10 14:39:29 -03:00
Mario Caropreso
582b44175b Added escaping of U+2028 and U+2029 inside the json encoder.
U+2028 and U+2029 are allowed inside strings in JSON (as all literal
Unicode characters) but JavaScript defines them as newline
seperators. Because no literal newlines are allowed in a string, this
causes a ParseError in the browser. We work around this issue by
replacing them with the escaped version. The resulting JSON is still
valid and can be parsed in the browser.

This commit has been coauthored with Viktor Kelemen @yikulju
2013-05-09 13:41:56 +01:00
Sean Walbran
2ed9ab2ed6 add changelog entry for fix-10502-skip-object-filter 2013-05-07 14:11:52 -05:00
Daniel Schierbeck
36d41a15c3 Allow fetching multiple values from the cache at once
Add a simple API for fetching a list of entries from the cache, where
any missing entries are computed by a supplied block.
2013-05-06 11:38:51 +02:00
Rafael Mendonça França
feb44b9213 rails/master is now 4.1.0.beta 2013-04-29 13:15:24 -03:00
Rafael Mendonça França
07acf7b13d Move CHANGELOG entry to top
[ci skip]
2013-04-22 01:42:30 -03:00
Rafael Mendonça França
dab58bee2a Merge pull request #10096 from benofsky/fix_skipping_object_callback_filters
Fixes skipping object callback filters
2013-04-21 21:19:18 -07:00
Daniel Schierbeck
5f07048dfd Extract a base class from ActiveSupport::LogSubscriber
Adds a ActiveSupport::Subscriber base class that LogSubscriber inherits
from. By inheriting from Subscriber, other kinds of subscribers can take
advantage of the event attachment system.
2013-04-16 14:39:22 +02:00
Yves Senn
c245437de7 use unified and clean formatting in CHANGELOGS. [ci skip] 2013-04-12 15:52:43 +02:00
Vijay Dev
b15ce4a006 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	guides/source/action_mailer_basics.md
2013-04-11 22:58:14 +05:30
Agis Anastasopoulos
0974b392ef Fix markdown formatting 2013-04-06 21:13:59 +03:00
Agis-
941986c7db Add option to Class#class_attribute for skipping the query method 2013-04-06 20:34:13 +03:00
Aaron Patterson
dfdc1e31a2 fast_xs support has been removed. Use 'String#encode(xml: :attr)`. 2013-04-05 22:31:17 -07:00
Ben McRedmond
8e1d3cd490 Fixes skipping object callback filters
This allows you to skip callbacks that are defined by objects, e.g. for
`ActionController`:

    skip_after_filter MySpecialFilter

Previously this didn't work due to a bug in how Rails compared callbacks
in `Callback#matches?`. When a callback is compiled, if it's an object
filter (i.e. not a method, proc, etc.), `Callback` now defines a method on
`@klass` that is derived from the class name rather than `@callback_id`.
So, when `skip_callback` tries to find the appropriate callback to
remove, `Callback` can regenerate the method name for the filter
object and return the correct value for `Callback#matches?`.
2013-04-04 16:11:13 -07:00
Rafael Mendonça França
49a0f554a6 Revert "Merge pull request #10034 from benofsky/fix_skipping_object_callback_filters"
This reverts commit c79c6980647eb76bfa52178711fb04ba7e9d403b, reversing
changes made to ba4c27479add60b783a0e623c8a5d176c1dc9043.

This broke all the tests. See https://travis-ci.org/rails/rails/builds/6061839
2013-04-04 18:19:55 -03:00
Ben McRedmond
e377228342 Fixes skipping object callback filters
This allows you to skip callbacks that are defined by objects, e.g. for
`ActionController`:

    skip_after_filter MySpecialFilter

Previously this didn't work due to a bug in how Rails compared callbacks
in `Callback#matches?`. When a callback is compiled, if it's an object
filter (i.e. not a method, proc, etc.), `Callback` now defines a method on
`@klass` that is derived from the class name rather than `@callback_id`.
So, when `skip_callback` tries to find the appropriate callback to
remove, `Callback` can regenerate the method name for the filter
object and return the correct value for `Callback#matches?`.
2013-04-04 11:45:13 -07:00
Vijay Dev
e63086c135 Merge branch 'master' of github.com:rails/rails 2013-03-30 15:47:38 +05:30
Vijay Dev
6d8c070821 Merge branch 'master' of github.com:lifo/docrails
Conflicts:
	activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
	activerecord/test/cases/adapter_test.rb
	guides/source/testing.md

[ci skip]
2013-03-30 15:46:14 +05:30
Vijay Dev
06e22c01e8 Revert "Using American English spellings over British style spellings"
This reverts commit 573df1cf2a5d5d1f288c8a4a5d76194675141832.

Reason: changelog edits aren't allowed in docrails.

[ci skip]
2013-03-30 15:12:23 +05:30
Rafael Mendonça França
57fbcc5247 Merge pull request #9523 from stopdropandrew/Instrumenter#instrument-yields-payload
ActiveSupport::Notifications::Instrumenter#instrument should yield

Conflicts:
	activesupport/CHANGELOG.md
2013-03-27 17:43:33 -03:00
Prathamesh Sonpatki
573df1cf2a Using American English spellings over British style spellings 2013-03-21 20:41:45 +05:30
Yves Senn
836ea9fb42 TimeWithZone raises NoMethodError in proper context.
Closes #9772.

`TimeWithZone` delegates everything to the wrapped `Time` object
using `method_missing`. The result is that `NoMethodError` error
will be raised in the context of `Time` which leads to a misleading
debug output.
2013-03-18 17:41:34 +01:00
Steve Klabnik
feaa6e2048 Revert "Merge pull request #8156 from fredwu/acronym_fix-master"
This reverts commit 867dc1700f32aae6f98c4651bd501597e6b52bc0, reversing
changes made to 9a421aaa8285cf2a7ecb1af370748b0337818930.

This breaks anyone who's using ForceSSL: https://travis-ci.org/rails-api/rails-api/jobs/5556065

Please see comments on #8156 for some discussion.
2013-03-16 15:25:49 -07:00
Xavier Noria
e958eabeb1 revises the CHANGELOG entry from 26aa265 [ci skip] 2013-03-16 16:03:09 +01:00
Fred Wu
26aa26564d Added Inflector#underscore fix to the changelog 2013-03-17 00:32:28 +11:00
Yves Senn
f8b0e54939 CHANGELOG entry for improved singularizing of singulars.
Closes #9559.

The actual patch was added with #4719
2013-03-06 08:28:23 +01:00
stopdropandrew
a007800a55 ActiveSupport::Notifications::Instrumenter#instrument should yield
its payload the same way that ActiveSupport::Notifications does.
Fix spelling in test name.
2013-03-02 16:05:05 -08:00
Steve Klabnik
5112a6ccdf Move AS CHANGELOG entry up.
I merged b883706 but forgot to move the entry past beta1.
2013-02-26 11:21:37 -08:00
Steve Klabnik
95883ca4b1 Merge pull request #9329 from chuckbjones/fix-cache-delete-rc
Fix deletion of empty directories
2013-02-26 11:15:29 -08:00
Rafael Mendonça França
0f75e2c51f Update CHANGELOGS 2013-02-26 13:45:57 -03:00
Charles Jones
b8837066dc Fix deletion of empty directories:
1. When comparing the directory to delete against the top level
   cache_path, use File.realpath to make sure we aren't comparing two
   unequal strings that point to the same path. This occurs, for
   example, when cache_path has a trailing slash, which it does in the
   default Rails configuration. Since the input to
   delete_empty_directories never has a trailing slash, the comparison
   will never be true and the top level cache directory (and above) may
   be deleted. However…

2. File.delete raises EPERM when trying to delete a directory, so no
   directories have ever been deleted. Changing the code to Dir.delete
   fixes that.
2013-02-25 18:54:44 -06:00
David Heinemeier Hansson
c0bc9ce38c Preparing for 4.0.0.beta1 release 2013-02-25 08:31:50 -06:00
Chris Baynes
fa891a2b9d Keep second fraction when DateTime#change is called. 2013-02-25 11:05:49 +01:00
Rafael Mendonça França
51e963790f Add more information to the CHANGELOG entry [ci skip] 2013-02-24 18:36:45 -03:00
stopdropandrew
cb100ca02b Added ActiveSupport::TimeWithZone#to_r for Time#at compatibility. 2013-02-24 13:24:50 -08:00
Xavier Noria
1509844cdd did a pass over the AS changelog [ci skip] 2013-02-24 21:26:02 +01:00
Carlos Antonio da Silva
1fbfdf5e1b Changelog improvements, use 1.9 style hash in examples [ci skip] 2013-02-22 19:44:50 -03:00
hoffm
4e3ceedeba Address edge case for number_to_human with units option.
ActiveSupport::NumberHelper#number_to_human now returns the number unaltered when
the units hash does not contain the needed key, e.g. when the number provided is less
than the largest key provided.
2013-02-22 08:25:51 -05:00
Gagan Awhad
6f380d3778 Added beginning_of_minute support to core_ext calculations for Time and DateTime 2013-02-21 16:14:16 -06:00
Xavier Noria
20ed3e0f71 moves the new :nsec date format to the Active Support changelog [ci skip] 2013-02-20 18:08:55 +01:00
Beyond
d59a877da4 added compress options for gzip
added test for compress options of gzip

update changelog
2013-02-10 20:01:42 +09:00
Carlos Antonio da Silva
2f0c26bf59 Update changelog from #9128 with author name
And improve AS changelog a bit [ci skip]
2013-02-06 19:02:40 -02:00
James Harton
28ab79d7c5 Modify TimeWithZone#as_json to return 3DP of sub-second accuracy by default, since it's allowed by the spec and is very useful. 2013-01-31 14:11:51 +13:00
Carlos Antonio da Silva
68f69ec31e Move AS changelog entry to the top, improve AP changelog a bit
[ci skip]
2013-01-28 19:40:18 -02:00
Antoine Lyset
b5245da94a Improve String#squish whitespaces matching 2013-01-22 22:46:11 +01:00
Andrew White
b79adc4323 Standardise the return value of to_time
This commit standardises the return value of `to_time` to an instance
of `Time` in the local system timezone, matching the Ruby core and
standard library behavior.

The default form for `String#to_time` has been changed from :utc to
:local but research seems to suggest the latter is the more common form.

Also fix an edge condition with `String#to_time` where the string has
a timezone offset in it and the mode is :local. e.g:

  # Before:
  >> "2000-01-01 00:00:00 -0500".to_time(:local)
  => 2000-01-01 05:00:00 -0500

  # After:
  >> "2000-01-01 00:00:00 -0500".to_time(:local)
  => 2000-01-01 00:00:00 -0500

Closes #2453
2013-01-21 12:33:49 +00:00
Yves Senn
3e1ed7818b extract PerformanceTest into rails-performance_tests gem 2013-01-10 17:09:06 +01:00
Jeremy Kemper
46e0d2397e CVE-2013-0156: Safe XML params parsing. Doesn't allow symbols or yaml. 2013-01-08 12:42:29 -08:00
Jeremy Kemper
c31cc963da Revert "Merge branch 'master-sec'"
This reverts commit 88cc1688d0cb828c17706b41a8bd27870f2a2beb, reversing
changes made to f049016cd348627bf8db0d72382d7580bf802a79.
2013-01-08 12:41:04 -08:00
Jeremy Kemper
2ced6f2f8a CVE-2013-0156: Safe XML params parsing. Doesn't allow symbols or yaml. 2013-01-08 12:03:34 -08:00
Yves Senn
947e1d5e85 deprecate assert_blank and assert_present.
They don't add any benefits over `assert object.blank?`
and `assert object.present?`
2013-01-05 18:04:52 +01:00
Carlos Antonio da Silva
149b86d97b Move changelog entry in railties to the top
Other minor changelog improvements [ci skip]
2013-01-04 22:49:14 -02:00
Kelly Stannard
ebd27d5714 Better error message for String#to_date
I did this because to_date gives a very unhelpful error message if you
do not pass in a correct date. In the process I think this cleans up the
 code nicely and even better it tends to be slightly faster than the
 current implementation.

Benchmark
https://gist.github.com/4440875
2013-01-04 16:39:18 +00:00
bUg
38f28dca3a Added ability to compare date/time with infinity
Date, DateTime, Time and TimeWithZone can now be compared to infinity,
  so it's now possible to create ranges with one infinite bound and
  date/time object as another bound.

  Ex.: @range = Range.new(Date.today, Float::INFINITY)

Also it's possible to check inclusion of date/time in range with
  conversion.

  Ex.: @range.include?(Time.now + 1.year) # => true
       @range.include?(DateTime.now + 1.year) # => true

Ability to create date/time ranges with infinite bound is required
  for handling postgresql range types.
2013-01-04 02:41:09 +01:00
Carlos Antonio da Silva
9f200fb296 Changelog improvements [ci skip] 2013-01-02 21:11:11 -02:00
Akira Matsuda
b6aa59368b missing changelog entry for #8682 2013-01-02 19:19:33 -03:00
Jeremy Kemper
f75addd06b Introduce assert_not to replace 'assert !foo' 2012-12-28 10:34:26 -07:00
Rafael Mendonça França
ecc7751575 Merge pull request #7376 from dmitriy-kiriyenko/fix-double-callback-in-same-statement
Prevent callback from being set twice.

Conflicts:
	activesupport/CHANGELOG.md
2012-12-21 17:39:03 -03:00
David Heinemeier Hansson
95f5f8167f Revert "Make sure that ActiveSupport::Logger includes the Logger extensions from core_ext/logger" (some confusion over deprecation)
This reverts commit d00f568a83a5159ed93618b1081bd17858536d1c.
2012-12-21 19:35:10 +01:00
David Heinemeier Hansson
d00f568a83 Make sure that ActiveSupport::Logger includes the Logger extensions from core_ext/logger 2012-12-21 19:28:24 +01:00
David Heinemeier Hansson
f914454f3a Add ActiveSupport::Logger#silence that works the same as the old Logger#silence extension 2012-12-21 19:15:36 +01:00
Dmitriy Kiriyenko
4a9644a0d9 Prevent callback from being set twice.
When you add one callack in two separate `set_callback` calls - it is
only called once.

When you do it in one `set_callback` call - it is called twice.

This violates the principle of least astonishment for me. Duplicating
callback is usually an error. There is a correct and obvious way to do
anything without this "feature".

If you want to do

    before_save :clear_balance, :calculate_tax, :clear_balance

or whatever, you should better do

    before_save :carefully_calculate_tax

    def carefully_calculate_tax
      clear_balance
      calculate_tax
      clear_balance
    end

And this even opens gates for some advanced refactorings, unlike the
first approach.

My assumptions are:

- Principle of least astonishment is violated, when callbacks are either
  prevented from duplication, or not.
- Duplicating callbacks is usually an error. When it is intentional -
  it's a smell of a bad design and can be approached without abusing
  this "feature".

My suggestion is: do not allow duplicating callbacks in one callback
call, like it is not allowed in separate callbacks call.
2012-12-20 11:06:45 +02:00
Carlos Antonio da Silva
42b555dcf3 Fix Action Mailer changelog indenation to match other changelogs
Also some minor improvements to other changelogs. [ci skip]
2012-12-19 23:09:04 -02:00
Brett Carter
8f8397e0a4 Remove unicode character encoding from ActiveSupport::JSON.encode
The encoding scheme (e.g. ☠ -> "\u2620") was broken for characters
not in the Basic Multilingual Plane.  It is possible to escape them
for json using the weird encoding scheme of a twelve-character
sequence representing the UTF-16 surrogate pair (e.g. '𠜎' ->
"\u270e\u263a") but this wasn't properly handled in the escaping code.
Since raw UTF-8 is allowed in json, it was decided to simply pass
through the raw bytes rather than attempt to escape them.
2012-12-14 18:54:32 -05:00
Carlos Antonio da Silva
df9f9b7f3e Convert changelogs to 1.9 hash style and fix some formatting [ci skip] 2012-12-14 20:25:22 -02:00
Andrew White
48583f8bf7 Deprecate obsolete Time to DateTime fallback methods
The Time.time_with_datetime_fallback, Time.utc_time and Time.local_time
methods were added to handle the limitations of Ruby's native Time
implementation. Those limitations no longer apply so we are deprecating
them in 4.0 and they will be removed in 4.1.
2012-12-11 13:57:05 +00:00
Andrew White
224d82ee59 Deprecate Date#to_time_in_current_zone
The to_time_in_current_zone method doesn't match the naming of the methods
for converting to ActiveSupport::TimeWithZone on Time and DateTime. Since
DateTime inherits from Date that has led to confusion with some users
using the to_time_in_current_zone method with DateTime instances and having
the time part dropped and the UTC offset lost.

This commit fixes this by deprecating the old method and adding a new
in_time_zone method which matches the naming for DateTime and Time. This
should prevent accidently dropping times and UTC offsets when converting
DateTime instances to ActiveSupport::TimeWithZone.
2012-12-11 07:06:34 +00:00
Andrew White
331a82a1c8 Add String#in_time_zone method
This commit adds a convenience method for converting a string to an
ActiveSupport::TimeWithZone instance using the configured Time.zone or
another passed as an argument.
2012-12-11 06:32:28 +00:00
Francesco Rodriguez
6ee03a40bb Rename ActiveSupport::BasicObject to ActiveSupport::ProxyObject
AS::BasicObject is used for proxy classes. Let's give it a less concerning
name. Also, it avoids the confusion with Ruby's Basic Object.
2012-12-07 14:13:56 -05:00
Uriel Katz
9ee0ffb360 Patched Marshal#load to work with constant autoloading (active_support/dependecies.rb) (issue #8167) 2012-12-01 14:00:16 +02:00
Andrew White
005d910624 Make Time.zone.parse to work with JavaScript date strings
Chrome, Safari and Firefox serialize Date objects to strings such
as 'Mon May 28 2012 00:00:00 GMT-0700 (PDT)'. When these strings
are parsed the zone is interpreted as 'GMT-0700' which doesn't
exist in the TzInfo list of timezones.

By taking advantage of the improved date/time handling in 1.9.3
we can use `Date._parse` and the `:offset` value which is parsed
correctly.

Three tests were amended to make them pass:

1.  test_parse_with_old_date

    This needed changing to a different value because the original
    value was before EST was adopted so was being changed to a
    LMT (Local Mean Time) value after the change. It didn't before
    because `DateTime` just has offsets from UTC not timezones.

2.  test_parse_should_not_black_out_system_timezone_dst_jump

    Changed the implementation of this test as the stubs were
    dependent on internal implementation details of the test.
    Confirmed that the modified test still failed when the
    implementation of `parse` was restored to pre-#5571.

3.  test_parse_should_black_out_app_timezone_dst_jump

    Ditto.

Closes #5770.
2012-12-01 11:34:21 +00:00
Olek Janiszewski
ce73055139 Add #seconds_until_end_of_day to DateTime and Time 2012-11-29 06:39:32 +01:00
Steve Klabnik
bd852603a1 Simplify String#mb_chars and stop proxying #class
This behavior mattered under Ruby 1.8, but that doesn't matter now
that we don't support it.

In addition, we don't want to proxy the #class method. A test was added
to prevent against regressions.
2012-11-28 13:58:51 -08:00
Carlos Antonio da Silva
92da512125 Properly deprecate #pending from AS::TestCase
Check https://github.com/rails/rails/pull/4575#issuecomment-5765575.
2012-11-18 21:34:00 -02:00
Carlos Antonio da Silva
4913984122 Revert "Merge pull request #4575 from carlosantoniodasilva/remove-test-pending"
This reverts commit 1620df78dff527b4fa3f7b204fa05d1b630aae17, reversing
changes made to 2d000328dfc0d4b297fb4bdcebc9af6c2fb559dc.

Conflicts:
	activesupport/CHANGELOG.md
	activesupport/lib/active_support/test_case.rb
2012-11-18 21:34:00 -02:00
Rafael Mendonça França
cf3eb6dab0 Merge pull request #8219 from nikitug/threadsafe_xmlmini_with_backend
Make XmlMini.with_backend usable with threads

Conflicts:
	activesupport/CHANGELOG.md
2012-11-15 15:50:39 -02:00
Nikita Afanasenko
1fab2002e3 Make XmlMini.with_backend usable with threads
`XmlMini.with_backend` now may be safely used with threads:

  Thread.new do
    XmlMini.with_backend("REXML") { rexml_power }
  end
  Thread.new do
    XmlMini.with_backend("LibXML") { libxml_power }
  end

Each thread will use it's own backend.
2012-11-15 20:23:05 +04:00
Xavier Noria
a8c3ea90f1 let remove_constant still delete Kernel#autoload constants [rounds #8213]
The method #remove_const does not load the file, so we
can still remove the constant.
2012-11-15 11:10:03 +01:00
Xavier Noria
bff4d8d165 dependencies no longer trigger Kernel#autoload in remove_const [fixes #8213] 2012-11-15 04:36:36 +01:00
Carlos Antonio da Silva
c940aa6ed5 Use new mocha version and add changelog entry for #8180 2012-11-13 08:57:04 -02:00
Yves Senn
78dca35103 #as_json isolates options when encoding a hash. Closes #8182
Setting options in a custom `#as_json` method had side effects.
Modifications of the `options` hash leaked outside and influenced
the conversion of other objects contained in the hash.
2012-11-12 16:06:08 +01:00
Steve Klabnik
88d59de12d Deprecate Hash#diff.
It's no longer used in Rails any more.

See https://github.com/rails/rails/pull/8142\#issuecomment-10227297 for more
2012-11-09 15:57:18 +01:00
Carlos Antonio da Silva
b67a03cf0b Merge pull request #7763 from route/full-capture
Kernel#capture replaced by version which can catch output from subprocesses
2012-11-08 18:10:54 -08:00
Nikita Afanasenko
9cda6a321e Use tag! instead of method_missing in to_xml conversions.
Since version `3.0.x` `Builder` caches method passed to `method_missing` each time. This commit replaces `method_missing` call with `tag!` call to prevent method redefinition on each `to_xml` call with the same builder.
2012-11-04 14:33:39 +04:00
Steve Klabnik
642e1af6f1 Fixed timezone mapping of Solomon Islands.
Fixes #8095.

For reference, here is the discussion about the mapping being
incorrect:
http://rubyforge.org/pipermail/tzinfo-users/2012-November/000114.html
2012-11-01 18:10:48 -07:00
Dmitry Vorotilin
346ccf376c Kernel#capture replaced by version which can catch output from subprocesses 2012-11-01 13:36:40 +04:00
Alexey Gaziev
b955939d55 Make caller attribute in deprecation methods optional 2012-10-30 10:23:41 +08:00
Daniele Sluijters
851f8c1023 atomicc.rb: Don't assume we may chown/chmod a file.
Previously this code just assumed it is capable of changing the file
ownership, both user and group. This will fail in a lot of scenario's
unless:
* The process is run as a superuser (root);
* The owning user and group are already set to the user and group we're
  trying to chown to;
* The user chown'ing only changes the group to another group it is a
  member of.
If either of those conditions are not met the filesystem will simply
deny the operation throwing an error.

It is also not always possible to do a chmod, there might be a SELinux
policy or another limitation preventing the user to change the file
mode. To this end the chmod call has also been added to the rescue
block.

I've also added a little comment above the chmod command that doing a
chmod on a file which has an ACL set will cause the ACL to be
recalculated / modified.
2012-10-29 10:04:59 +01:00
David Graham
f38e752bdf Implement replace method so key? works correctly. 2012-10-26 11:36:35 -06:00
Mikhail Dieterle
a4b1196163 add more testcases and doc about Hash#extract! 2012-10-08 01:20:37 +03:00
Mikhail Dieterle
5d27338ab0 make Hash#extract! more symmetric with Hash#slice 2012-10-08 01:20:36 +03:00
Rafael Mendonça França
cfc0ca0516 Merge pull request #7708 from bdurand/optimize_log_subscribers
Optimize log subscribers to check if the log level is sufficient
2012-10-01 20:28:31 -07:00
Rafael Mendonça França
325748d6b5 New CHANGELOG entries always in the top 2012-10-01 23:17:13 -03:00
Brian Durand
37852726c9 Optimize log subscribers to check if the log level is sufficient before performing an operations. 2012-09-30 09:47:24 -07:00
Brian Durand
e3a746b6fc Optimize ActiveSupport::Cache::Entry to reduce memory and processing overhead. 2012-09-30 09:26:04 -07:00
Jeremy Kemper
86ebe0bd36 Tests tag the Rails log with the current test class and test case 2012-09-26 11:17:02 -07:00
Jeremy Kemper
d36f57f430 Add logger.push_tags and .pop_tags to complement logger.tagged 2012-09-26 10:16:40 -07:00
Carlos Antonio da Silva
1eef814e7a Add changelog entry and docs about class delegation using the symbol :class
See #7613. [ci skip]
2012-09-20 18:50:53 -03:00
gregolsen
da26dfbefd Date.beginning_of_week thread local and beginning_of_week application config option added (default is Monday) 2012-09-18 17:18:19 +03:00
Larry Lv
1efe30ebce set up config_accessor with a default value by block
* ActiveSupport::Configurable should allow config_accessor to take
  default value by block, just like cattr_accessor.

    class User
      include ActiveSupport::Configurable
      config_accessor :hair_colors do
        [:brown, :black, :blonde, :red]
      end
    end

    User.hair_colors # => [:brown, :black, :blonde, :red]

* remove trailing whitespaces in configurable.rb and its test file.

* Update ActiveSupport CHANGELOG.
2012-09-17 09:14:21 +08:00
Steve Klabnik
ed2fea908a Deprecate ActiveSupport::Benchmarkable#silence.
Due to its lack of thread safety, we're deprecating this, and it
will be removed in Rails 4.1.

Fixes #4060.
2012-09-15 06:19:55 +04:00
Pranas Kiziela
54575d8797 Allow passing block to deep_merge and deep_merge!
Hash#merge accepts block that you can use to customize how hash values
are merged. This change makes merge and deep_merge compatible.
2012-09-13 23:01:18 +03:00
Rafael Mendonça França
8692db59af Copy-edit deprecation relared documentation [ci skip] 2012-09-13 14:02:18 -03:00
Piotr Niełacny
71993c6f97 Change ActiveSupport::Deprecation to class.
ActiveSupport::Deprecation is now a class rather than a module. You can
get instance of ActiveSupport::Deprecation calling #instance method.

  ActiveSupport::Deprecation.instance

But when you need to get new object od ActiveSupport::Deprecation you
need to just call #new.

  @instance = ActiveSupport::Deprecation.new

Since you can create a new object, you can change the version and the
name of the library where the deprecator concerned.

  ActiveSupport::Deprecation.new('2.0', 'MyGem')

If you need use another deprecator instance you can select it in the
options of deprecate method.

  deprecate :method, :deprecator => deprecator_instance

Documentation has been updated.
2012-09-13 08:42:00 +02:00
Bogdan Gusiev
f11fc7308a Revert "Changelog entry for PR #7560"
This reverts commit ca80067bbe4662c60b933188ad3769605742e812.
Entry already added in 895233
2012-09-10 21:57:57 +03:00
Bogdan Gusiev
ca80067bbe Changelog entry for PR #7560 2012-09-10 21:38:12 +03:00
Kalys Osmonov
6b2a24c3bd &#39 dates back to SGML when &#x27 was introduced in HTML 4.0 2012-09-09 19:48:32 +06:00
Carlos Antonio da Silva
dcc68fa443 Fix Active Support changelog formatting [ci skip] 2012-09-07 11:12:16 -03:00
Carlos Antonio da Silva
8952339750 Add Changelog entry for #7560: deprecate #filter in AS::Callbacks [ci skip] 2012-09-07 11:12:00 -03:00
Leo Cassarani
edab820d9e Extend HashWithIndifferentAccess#update to take an optional block
When a block is passed into the method, it will be invoked for each
duplicated key, with the key in question and the two values as
arguments. The value for the duplicated key in the receiver will
be set to the return value of the block.

This behaviour matches Ruby's long-standing implementation of
Hash#update and is intended to provide a more consistent interface.

HashWithIndifferentAccess#merge is also affected by the change, as it
uses #update internally.
2012-09-05 00:59:29 +01:00
Xavier Noria
810a50dacf CHANGELOGs are now per branch
Changes in old branches needed to be manually synched in CHANGELOGs of newer ones.
This has proven to be brittle, sometimes one just forgets this manual step.
With this commit we switch to CHANGELOGs per branch. When a new major version is
cut from master, the CHANGELOGs in master start being blank.

A link to the CHANGELOG of the previous branch allows anyone interested to
follow the history.
2012-08-28 21:15:16 +02:00
Rafael Mendonça França
8c6fcbc2b1 Add CHANGELOG entry for #3578 [ci skip] 2012-08-21 18:39:37 -03:00
Guillermo Iguaran
82663306f4 Replace deprecated memcache-client gem with dalli in ActiveSupport::Cache::MemCacheStore
memcache-client was deprecated in favour of dalli in 2010.
2012-08-17 22:22:55 -05:00
Rafael Mendonça França
8781b266b9 Sync CHANGELOGs [ci skip] 2012-08-11 13:13:58 -03:00
Carlos Antonio da Silva
a9dccda936 Fallback to :en locale instead of handling a constant with defaults
Action Pack already comes with a default locale fine for :en, that is
always loaded. We can just fallback to this locale for defaults, if
values for the current locale cannot be found.

Closes #4420, #2802, #2890.
2012-08-11 00:20:19 -03:00
Carlos Antonio da Silva
b6e00c6764 Bring back changelog entries for Active Support
Removed in 0228a73b1094a3e19ad291d2ce4789890c09578a, pull request #7310.
2012-08-11 00:16:42 -03:00
Mark Turner
0228a73b10 Add html_escape note to CHANGELOG 2012-08-09 16:54:52 -07:00
Erich Menge
83f2ffcf43 Deprecate ActiveSupport::JSON::Variable
Reason: ActiveSupport::JSON::Variable is not used anymore internally. It
was deprecated in 3-2-stable but we reverted all the deprecation for
point releases.

See #6536 and #6546.
Conflicts:
	activesupport/lib/active_support/json/variable.rb
2012-08-07 19:36:08 -03:00
Xavier Noria
2f58795e78 defines String#indent [closes #7263] [Xavier Noria & Ace Suares] 2012-08-07 16:57:28 +02:00
José Valim
0e3c66691a Update activesupport/CHANGELOG.md 2012-07-31 15:48:17 +03:00
David Heinemeier Hansson
04998cd0c9 Add Object#try! with the old NoMethodError raising behavior 2012-07-27 12:33:02 -05:00
David Heinemeier Hansson
99ea1a875b will now return nil instead of raise a NoMethodError if the receiving object does not implement the method 2012-07-27 12:22:38 -05:00
Carlos Antonio da Silva
215d41d802 Update 4.0 Release Notes with changelogs [ci skip]
Also fix some wrong formatting.

Related discussion:
ab72040b74 (commitcomment-1525256)
2012-07-02 22:34:51 -03:00
Andrew White
98b46bf5e2 Make Time#change work with offsets other than UTC or local
Use Time.new to create times where the current offset is not zero or
not in the local time zone - closes #4847 and #6651.
2012-07-01 09:11:21 +01:00
Bogdan Gusiev
88230b7cf7 AS::Callbacks: deprecate monkey patch code
Deprecate usage of filter object with #before and #after
methods as around callback
2012-06-26 09:21:36 +03:00
paranoiase Kang
2773257ac6 Add prev_quarter and next_quarter method in Time/Date/DateTime 2012-06-20 11:39:11 -03:00
Xavier Noria
d3a99c32d1 removes the obsolete require_association method from dependencies
This is an obsolete method from the very early days,
apparently it was used circa 2004 because STI support
was not smart enough. This method is not public
interface, and we are heading a major version, so
removal seems right.
2012-06-10 00:38:40 +02:00
Francesco Rodriguez
5e1d40f773 add instance_accessor option to ActiveSupport::Configurable#config_accessor
Changes:

* Add `instance_accessor` option to opt out of the instance writer and
  instance reader methods.
* Raises a NameError if the name of the attribute is not valid.
* Update documentation and tests.
* Add CHANGELOG entry in activesupport.
2012-06-05 10:50:48 -05:00
Rafael Mendonça França
3449b757da Sync CHANGLOG with the 3-2-stable branch 2012-06-01 11:41:30 -03:00
Erich Menge
1f5dddcf2f Remove deprecated ActiveSupport::JSON::Variable. 2012-05-30 14:39:00 -05:00
Andrew Mutz
155cd5e6b5 Moving NumberHelpers from ActionView to ActiveSupport 2012-05-27 18:14:21 -07:00
Mark McSpadden
2b5b60fc3c Add Hash#deep_transform_keys and Hash#deep_transform_keys! Also convert deep_*_keys to use deep_transform_keys. 2012-05-23 13:11:06 -05:00
Lucas Húngaro
a4bb195c91 Adding deep versions of stringify_keys and symbolize_keys (plain and bang) for nested hashes 2012-05-23 11:56:10 -03:00
Mark McSpadden
6ff887321b Add Hash#transform_keys and Hash#transform_keys! and refactor *_keys methods to use them. 2012-05-23 09:08:04 -05:00
Angelo capilleri
5646d65d01 changed xml type datetime to dateTime, fixes #6328
XmlMini define the xml 'datatime', but according to
http://www.w3.org/TR/xmlschema-2/#dateTime could be better
change this to 'dateTime' with upper case letter 'T.
So 'DateTime' and 'Time' are redefined from 'datetime' to 'dateTime'

add the changing to the changelog
2012-05-23 14:45:56 +02:00
Alexey Vakhov
e4569b50d1 Add instance_accessor option to class_attribute 2012-05-22 00:28:34 +04:00
Andrew White
329a5a4322 Add CHANGELOG entry for constantize - closes #6165. 2012-05-19 15:47:35 +01:00
Xavier Noria
e5b91f2b1d copy-edits a recent CHANGELOG entry [ci skip] 2012-05-12 17:48:34 +02:00
Vasiliy Ermolovich
b8f394f4a3 Object#try can't call private methods 2012-05-12 14:07:21 +03:00
Francesco Rodriguez
c1ce4144d1 AS::Callbacks#run_callbacks remove key argument 2012-05-10 02:21:03 -05:00
Mark J. Titorenko
946875db22 Consistent CHANGELOG entry indentation. 2012-05-09 13:40:08 +01:00
Mark J. Titorenko
821771374f Add CHANGELOG section for unreleased Rails 3.2.4; document addition of #beginning_of_hour and #end_of_hour to Time and DateTime core extensions. 2012-05-09 13:35:49 +01:00
Piotr Sarnacki
0403928608 Updated CHANGELOG entry for deep_dup 2012-05-06 11:13:15 -07:00
David FRANCOIS
18aa1ae29c BigDecimal string wrapping in JSON serialization can now be opted-out, fixes #6033 2012-05-02 07:16:00 +02:00
Carlos Antonio da Silva
01414424b1 Improve changelog of new :silence deprecation behavior 2012-04-30 09:11:11 -03:00
José Valim
c9cbc179e8 Update activesupport/CHANGELOG.md 2012-04-30 10:17:01 +03:00
Kirill Nikitin
c6e0bc600b Fix typo 2012-04-30 03:03:59 +04:00
Kirill Nikitin
1cf55e660d Remove repeated word 2012-04-30 01:45:06 +04:00
twinturbo
9608395923 Document #behavior= and update CHANGELOG 2012-04-28 13:40:30 -03:00
Daniel Schierbeck
1d48e50284 Add changelog entry 2012-04-12 14:59:21 +02:00
Rafael Mendonça França
d804790634 Fix my name in the CHANGELOG to follow the convention
Also add missing entries and use the formating convention
2012-03-09 00:54:21 -03:00
claudiob
05c6caf48c Add release dates to documentation
Set "March 1, 2012" as the release date for 3.2.2, 3.1.4, 3.0.12
2012-03-01 11:20:03 -08:00
Paco Guzman
152a393d4f Update changelogs with rails 3.0-stable branch info 2012-02-25 13:50:08 +01:00
Bogdan Gusiev
10bac29b33 AS::Callbacks: deprecate rescuable option 2012-02-22 17:43:13 +02:00
Vijay Dev
a470d79697 Document Integer#ordinal available in PR #2072.
Also remove an unasserted line in the tests.
2012-02-04 18:46:19 +05:30
Bogdan Gusiev
4f53091dd1 AS::Callbacks: rip out per_key option. 2012-02-04 13:31:00 +02:00
José Valim
b41ef0a448 Merge pull request #4866 from bogdan/terminate_after_callbacks
AS::Callbacks#define_callbacks: add :terminate_after_callbacks option
2012-02-04 02:53:47 -08:00
Bogdan Gusiev
7661955634 AS::Callbacks: :skip_after_callbacks_if_terminated option 2012-02-03 17:57:53 +02:00
Norman Clarke
27bf1b1c8e Added note about new Unicode version. 2012-02-03 10:20:25 -03:00
Carlos Antonio da Silva
608eddc6f5 Move escape_once logic to ERB::Util, where it belongs to
All the logic is based on the HTML_ESCAPE constant available in
ERB::Util, so it seems more logic to have the entire method there and
just delegate the helper to use it.
2012-02-01 08:55:18 -02:00
claudiob
6d426b1035 Add release date of Rails 3.2.0 to documentation 2012-01-26 01:53:38 -08:00
Carlos Antonio da Silva
c8504b1b56 Remove ActiveSupport::TestCase#pending, use skip instead 2012-01-21 14:32:28 -02:00
Xavier Noria
04df7bb02c deprecates Module#local_constant_names 2012-01-12 12:17:35 -08:00
Xavier Noria
748725e9ce removes the compatibility method Module#method_names 2011-12-25 11:11:50 -08:00
Xavier Noria
40bda76067 removes the compatibility method Module#instance_method_names 2011-12-25 11:11:49 -08:00
Aaron Patterson
367741ef22 Revert "Added Enumerable#pluck to wrap the common pattern of collect(&:method) *DHH*"
This reverts commit 4d20de8a50d889a09e6f5642984775fe796ca943.

Conflicts:

	activesupport/CHANGELOG.md
	activesupport/lib/active_support/core_ext/enumerable.rb
	activesupport/test/core_ext/enumerable_test.rb
2011-12-22 12:21:18 -07:00
Vijay Dev
10a5497f2e NullStore cache belongs in Active Support 2011-12-20 23:44:47 +05:30
Aaron Patterson
572c3d5178 * BufferedLogger is deprecated. Use ActiveSupport::Logger, or the logger
from Ruby stdlib.
2011-12-19 18:41:37 -08:00
Aaron Patterson
04ef93dae6 * ActiveSupport::BufferedLogger#silence is deprecated. If you want to squelch
logs for a certain block, change the log level for that block.

*   ActiveSupport::BufferedLogger#open_log is deprecated.  This method should
    not have been public in the first place.

*   ActiveSupport::BufferedLogger's behavior of automatically creating the
    directory for your log file is deprecated.  Please make sure to create the
    directory for your log file before instantiating.

*   ActiveSupport::BufferedLogger#auto_flushing is deprecated.  Either set the
    sync level on the underlying file handle like this:

        f = File.open('foo.log', 'w')
        f.sync = true
        ActiveSupport::BufferedLogger.new f

    Or tune your filesystem.  The FS cache is now what controls flushing.

*   ActiveSupport::BufferedLogger#flush is deprecated.  Set sync on your
    filehandle, or tune your filesystem.
2011-12-09 16:05:57 -08: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
d9c2882077 Module#synchronize is deprecated with no replacement. Please use monitor from ruby's standard library. 2011-11-29 15:40:46 -08:00
Xavier Noria
a5b362df56 some tweaks to PR#3547. [Closes #3547] 2011-11-25 12:02:49 -08:00
José Valim
71e84a3b51 Deprecated ActiveSupport::MessageEncryptor#encrypt and decrypt. 2011-11-09 20:04:42 -02: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
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