Commit Graph

5955 Commits

Author SHA1 Message Date
DAVID MOORE 4349192fa5 [ci skip] Update ActiveSupport::Rails and ActiveSupport::Rescuable docs
[Dave Moore]
2015-04-26 15:38:52 -04:00
Richard Schneeman 951ec03256 Merge pull request #19902 from khundawg/dm-active-support-subsciber-doc
[ci skip] Update ActiveSupport::Subscriber documentation
2015-04-25 21:44:36 -05:00
DAVID MOORE 4c945cccb5 [ci skip] Update ActiveSupport::Subscriber documentation 2015-04-25 22:09:30 -04:00
Nick Cox ea30e32998 [ci skip] Rework docs, add examples on deprecation proxies 2015-04-24 14:41:03 -07:00
Andrew White 3ab66a0ce4 Merge pull request #17333 from rails/encode-twz-tzinfo-in-yaml
Improve ActiveSupport::TimeWithZone conversion to YAML
2015-04-22 13:39:02 -04:00
Rafael Mendonça França eb9e863648 Merge pull request #19857 from sikachu/remove-alias-method-chain-doc
Clearify that alias_method_chain is deprecated
2015-04-22 13:20:42 -03:00
Andrew White 3aa26cfb19 Improve ActiveSupport::TimeWithZone conversion to YAML
Previously when converting AS::TimeWithZone to YAML it would be output
as a UTC timestamp. Whilst this preserves the time information accurately
it loses the timezone information. This commit changes that so that it is
saved along with the time information. It also provides nicer encoding of
AS::TimeZone instances themselves which previously embedded all of the
data from the TZInfo records.

Fixes #9183.
2015-04-22 12:12:39 -04:00
Andrew White 5302d244eb Refactor ActiveSupport::Timezone#strptime
Make strptime behave more like parse when components are missing and
share behavior between the two methods.
2015-04-22 12:05:07 -04:00
Paul A Jungwirth a5e507fa0b Add ActiveSupport::TimeZone#strptime.
This makes it easier to parse user-inputted times as from a given time zone.
2015-04-22 12:05:07 -04:00
Prem Sichanugrist 5bc7736806 Clearify that alias_method_chain is deprecated
This was not clear on the API documentation that the method was
deprecated in a982a42d76.
2015-04-22 12:03:34 -04:00
Yves Senn cdbf685994 pass over CHANGELOGs. [ci skip] 2015-04-22 14:44:30 +02:00
Rafael Mendonça França 9a1fa3e8f8 Merge pull request #19819 from gazay/no_fork_issue
MRI compatible code for ActiveSupport::Testing::Isolation::Subprocess
2015-04-22 03:36:59 -03:00
Rafael Mendonça França 8f3584ab30 Merge pull request #19814 from y-yagi/array_inquiry
add missing require for ArrayInquirer
2015-04-19 15:13:52 -04:00
Arthur Nogueira Neves 4e141f16ec Merge pull request #19799 from yui-knk/fix/wrap_doc2
[ci skip] Fix docs and guide about 'Array.wrap'
2015-04-19 09:53:19 -07:00
yui-knk c94577dd5c [ci skip] Fix docs and guide about 'Array.wrap' 2015-04-19 23:22:49 +09:00
yuuji.yaginuma 33653c8898 add missing require for ArrayInquirer 2015-04-19 20:26:05 +09:00
Alexey Gaziev 61103ac7b0 MRI compatible code for ActiveSupport::Testing::Isolation::Subprocess 2015-04-19 12:18:16 +08:00
yui-knk 581906de53 [ci skip] Replace `list` with `array` 2015-04-18 00:04:43 +09:00
Jon Atack 6345f31fbf Fix typos and improve the documentation
This is a squash of the following commits, from first to last:

-

Fix minor, random things I’ve come across lately that individually
did not seem worth making a PR for, so I saved them for one commit.

One common error is using “it’s” (which is an abbreviation of “it is”)
when the possessive “its” should be used for indicating possession.

-

Changes include the name of a test, so remove the `[skip ci]` (thanks @senny).

-

Line wrap the changes at 80 chars and add one more doc fix.

-

Add a missing line wrap in the Contributing to Ruby on Rails Guide.

-

Line wrap the `TIP` section in the Contributing to Ruby on Rails Guide as well.

Rendering the guide locally with `bundle exec rake guides:generate` did
not show any change in on-screen formatting after adding the line wrap.

The HTML generated is (extra line added to illustrate where the line
wrap takes place):

    <div class="info"><p>Please squash your commits into a single commit
when appropriate. This

    simplifies future cherry picks and also keeps the git log
clean.</p></div>

-

Squash commits.
2015-04-15 16:25:24 +05:30
Yuki Nishijima d3684c4154 Use #prepend rather than using 2 aliases 2015-04-14 10:13:14 -07:00
Guillermo Iguaran 33ea933d7b Merge pull request #19753 from jonatack/use-ruby-2-2-2
Upgrade to Ruby 2.2.2
2015-04-13 22:56:47 -05:00
Jon Atack 32f7491808 Upgrade to Ruby 2.2.2
and fix the grammar in the ruby_version_check.rb user message.
2015-04-14 08:41:56 +05:30
Vijay Dev 8ac458ad2e Merge branch 'master' of github.com:rails/docrails 2015-04-14 02:07:26 +00:00
ojab 1a0853c41f Speedup String#squish 2015-04-12 21:45:50 +00:00
Kohei Suzuki 16d7cfb177 Allow AS::Cache::FileStore#clear without cache directory
Currently `Rails.cache.clear` raises Errno::ENOENT if it's run just
after cloning a new Rails project. It should succeed without removing
files or directories.
2015-04-09 00:04:56 +09:00
Rafael Mendonça França 0a120a818d Avoid to define an initializer after the load_config_initializers
This make the config/initializers run before the railties are loaded
what can break some configurations.
2015-04-07 17:20:57 -03:00
Rafael Mendonça França 8b88df94eb Merge pull request #19029 from iainbeeston/skipping-undefined-callbacks
Raise ArgumentError if an unrecognised callback is skipped
2015-04-06 19:07:21 -03:00
Rafael Mendonça França c539cc0061 Merge pull request #19448 from tgxworld/fix_activesupport_callbacks_clash_on_run
Fix AS::Callbacks raising an error when `:run` callback is defined.
2015-04-06 18:58:19 -03:00
Matthew Draper ca14f11b07 Merge pull request #19625 from strzibny/fix-test-rails-git-layout
Do not depend on Rails git repository layout in ActiveSupport tests
2015-04-03 22:40:24 +10:30
Iain Beeston d2876141d0 Raise ArgumentError if an unrecognised callback is skipped
At present, if you skip a callback that hasn't been defined,
activesupport callbacks silently does nothing. However, it's easy to
mistype the name of a callback and mistakenly think that it's being
skipped, when it is not.

This problem even exists in the current test suite.
CallbacksTest::SkipCallbacksTest#test_skip_person attempts to skip
callbacks that were never set up.

This PR changes `skip_callback` to raise an `ArgumentError` if the
specified callback cannot be found.
2015-04-03 09:37:19 +01:00
Josef Stribny 097ac2045a Do not depend on Rails git repository layout in ActiveSupport tests 2015-04-02 17:09:24 +02:00
brainopia 58d75fd811 Freeze static arguments for gsub 2015-04-02 02:15:07 +03:00
brainopia cdac52e124 Prefer string patterns for gsub
https://github.com/ruby/ruby/pull/579 - there is a new optimization
since ruby 2.2

Previously regexp patterns were faster (since a string was converted to
regexp underneath anyway). But now string patterns are faster and
better reflect the purpose.

  Benchmark.ips do |bm|
    bm.report('regexp') { 'this is ::a random string'.gsub(/::/, '/') }
    bm.report('string') { 'this is ::a random string'.gsub('::', '/') }
    bm.compare!
  end
  # string: 753724.4 i/s
  # regexp: 501443.1 i/s - 1.50x slower
2015-04-02 02:07:45 +03:00
Aaron Jensen 97698606de Only coerce time when comparing if necessary
In dev, ActiveSupport::FileUpdateChecker#max_mtime triggers many
time comparisons. Time#to_time is quite a bit slower than not doing it,
so we should avoid it if possible.
2015-03-31 18:43:44 -07:00
yui-knk fd94aa4d57 [ci skip] Replace `query methods` with `a predicate` 2015-03-31 20:53:38 +09:00
yui-knk 65200a38b9 [ci skip] Remove unnecessary `>` 2015-03-31 20:10:12 +09:00
claudiob 89389c7e72 Fix doc: set_callback also accepts an array of if:
When Active Record calls `set_callback` inside `after_commit`,
[these lines of code](https://github.com/rails/rails/blob/master/activerecord/lib/active_record/transactions.rb#L276)
pass an **array** of methods as the `:if` condition:

```ruby
options[:if] = Array(options[:if])
options[:if] << "transaction_include_any_action?(#{fire_on})"
```

That made me realize that anyone could pass an **array** of `:if` and `:unless`
conditions to `set_callback`, since Active Support transforms these conditions
into an array anyways in [these lines of code](https://github.com/rails/rails/blob/master/activesupport/lib/active_support/callbacks.rb#L365):

```ruby
@if      = Array(options[:if])
@unless  = Array(options[:unless])
```

Long story short, this commit updates the documentation of the `set_callback`
method to explain that arrays are also accepted.

It also replaces +false+ and +true+ with false and true, since any _falsey_ or
_truthy_ value will work.

[ci skip]
2015-03-31 00:41:43 -07:00
Rafael Mendonça França f9433ef260 Require the extensions to tests pass in isolation 2015-03-30 13:59:50 -03:00
Rafael Mendonça França b5c35023bd Revert "Remove Array#inquiry"
This reverts commit 9420de59f5.

Reason: Turns out we want to keep this method.
2015-03-30 13:38:13 -03:00
Rafael Mendonça França 8bf2825205 Remove circular require 2015-03-27 16:58:49 -03:00
Rafael Mendonça França 9420de59f5 Remove Array#inquiry
We are promoting too much a feature that will not be widler used.
So for now lets keep just the ArrayInquirer constructor.
2015-03-27 16:25:13 -03:00
Rafael Mendonça França 5cb8e0046c Merge pull request #18939 from georgeclaghorn/variant-inquiry
Provide friendlier access to request variants
2015-03-27 16:20:52 -03:00
Akira Matsuda c31c40208b Missing require 'active_support/deprecation' 2015-03-27 16:19:45 +09:00
Vijay Dev c26ee64b92 Merge branch 'master' of github.com:rails/docrails
Conflicts:
	guides/source/4_0_release_notes.md
2015-03-26 16:22:41 +00:00
George Claghorn c64b99ecc9 Add ActiveSupport::ArrayInquirer and Array#inquiry
Wrapping an array in an `ArrayInquirer` gives a friendlier way to check its
string-like contents. For example, `request.variant` returns an `ArrayInquirer`
object. To check a request's variants, you can call:

    request.variant.phone?
    request.variant.any?(:phone, :tablet)

...instead of:

    request.variant.include?(:phone)
    request.variant.any? { |v| v.in?([:phone, :tablet]) }

`Array#inquiry` is a shortcut for wrapping the receiving array in an
`ArrayInquirer`:

    pets = [:cat, :dog]
    pets.cat?    # => true
    pets.ferret? # => false
    pets.any?(:cat, :ferret} # => true
2015-03-24 13:33:01 -05:00
Scott Walkinshaw 25b3f738e4 Update ActiveSupport::Subscriber docs
For consistency purposes with the changes done in https://github.com/rails/rails/pull/12285
2015-03-24 11:10:15 -04:00
Guo Xiang Tan ea5e3192d5 Fix incorrect description for `assert_nothing_raised`. 2015-03-24 15:32:13 +08:00
Rafael Mendonça França 639159cebe Merge pull request #19485 from tgxworld/small_doc_fix
Small doc fix. [CI SKIP]
2015-03-24 00:15:30 -03:00
Guo Xiang Tan 874616a905 Small doc fix. [CI SKIP] 2015-03-24 11:11:35 +08:00
David Cornu a64f3e4195 Make sure Array#to_sentence always returns a String 2015-03-23 15:47:37 -04:00