Commit Graph

50798 Commits

Author SHA1 Message Date
yui-knk
8f73c3ff61 [ci skip] Fix :having option with having method 2015-04-01 13:45:56 +09:00
Rafael Mendonça França
a6ecc06ece Merge pull request #19605 from 1337807/patch-1
Update routing.md
2015-04-01 00:37:31 -03:00
Jonan Scheffler
21a2d9a987 Update routing.md
This adds instructions for routing to rack applications with mount instead of match.

I just spent an unreasonable amount of time staring at this, hopefully the next person will save some time. It's possible that the docs should simply advise people to use mount and leave out the match method but I don't know enough about the differences in the two approaches to assert that definitively.
2015-04-01 00:37:23 -03:00
Rafael Mendonça França
e3e28e4dab Merge pull request #19604 from aaronjensen/speed-up-time-coercion
Only coerce time when comparing if necessary
2015-04-01 00:31:53 -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
Rafael Mendonça França
baa176e3f0 Merge pull request #19586 from mechanicles/fix-eager-loading-for-find-methods
Fix eager loading association using default_scope for finder methods.
2015-03-31 15:06:22 -03:00
Rafael Mendonça França
7f6af33de8 Merge pull request #19603 from eliotsykes/remove-considerations-section
Remove unused subdir deployment considerations section [ci skip]
2015-03-31 15:00:42 -03:00
Eliot Sykes
d402268d78 Remove unused subdir deployment considerations section [ci skip] 2015-03-31 18:47:45 +01:00
Santosh Wadghule
4596e16f1a Fix eager loading association using default_scope for finder methods.
- Eager loading was not working for the default_scope (class method)
  for 'find' & 'find_by' methods.
- Fixed these by adding a new check 'respond_to?(:default_scope)'.
2015-03-31 22:54:42 +05:30
Rafael Mendonça França
c8bd12cf5a Make method as nodoc since we are already docummenting at AbstractAdapter 2015-03-31 13:29:18 -03:00
Carlos Antonio da Silva
4185e84e61 Merge pull request #19599 from y-yagi/application_job_template
remove extra newline from ApplicationJob template
2015-03-31 11:29:42 -03:00
yuuji.yaginuma
655273cad1 remove extra newline from ApplicationJob template 2015-03-31 22:52:03 +09:00
Arthur Nogueira Neves
bb4e385d76 Merge pull request #19596 from yui-knk/fix/comment_alias_attribute
[ci skip] Replace `query methods` with `a predicate`
2015-03-31 09:13:30 -04:00
yui-knk
fd94aa4d57 [ci skip] Replace query methods with a predicate 2015-03-31 20:53:38 +09:00
Kir Shatrov
afbd6559f9 No need to mention unit tests in testing guide anymore 2015-03-31 14:38:28 +03:00
Kir Shatrov
851621bf19 New test runner syntax in testing guide 2015-03-31 14:38:28 +03:00
Kir Shatrov
487aa51b14 Suggest new hash syntax in testing guide 2015-03-31 14:38:28 +03:00
yui-knk
65200a38b9 [ci skip] Remove unnecessary > 2015-03-31 20:10:12 +09:00
Kir Shatrov
3cee8ce2e8 Don't suggest bin/rails test controllers 2015-03-31 13:45:17 +03:00
Yves Senn
347266280e Merge pull request #19595 from claudiob/fix-docs-set-callback
Fix doc: set_callback also accepts an array of if:
2015-03-31 09:45:59 +02: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
Yves Senn
f4bb96b8e9 Merge pull request #19523 from kuldeepaggarwal/fix-table-name-conflict
rename `widgets` table to `new_widgets`
2015-03-31 08:47:02 +02:00
Kuldeep Aggarwal
bf6a33fd82 use Model.reset_column_information to clear table cache connection wide.
`widgets` table is being created in `primary_keys_test.rb` for PostgreSQLAdapter, MysqlAdapter, Mysql2Adapter
    and it makes test to fail earlier.

    Before:
      `bundle exec rake mysql2:test`

    ```
    Finished in 127.287669s, 35.5258 runs/s, 97.8885 assertions/s.

      1) Error:
    PersistenceTest::SaveTest#test_save_touch_false:
    ActiveModel::UnknownAttributeError: unknown attribute 'name' for #<Class:0x0000000a7d6ef0>.
        /home/kd/projects/kd-rails/activerecord/lib/active_record/attribute_assignment.rb:36:in `rescue in _assign_attribute'
        /home/kd/projects/kd-rails/activerecord/lib/active_record/attribute_assignment.rb:34:in `_assign_attribute'
        /home/kd/projects/kd-rails/activemodel/lib/active_model/attribute_assignment.rb:40:in `block in _assign_attributes'
        /home/kd/projects/kd-rails/activemodel/lib/active_model/attribute_assignment.rb:39:in `each'
        /home/kd/projects/kd-rails/activemodel/lib/active_model/attribute_assignment.rb:39:in `_assign_attributes'
        /home/kd/projects/kd-rails/activerecord/lib/active_record/attribute_assignment.rb:26:in `_assign_attributes'
        /home/kd/projects/kd-rails/activemodel/lib/active_model/attribute_assignment.rb:33:in `assign_attributes'
        /home/kd/projects/kd-rails/activerecord/lib/active_record/core.rb:293:in `initialize'
        /home/kd/projects/kd-rails/activerecord/lib/active_record/inheritance.rb:61:in `new'
        /home/kd/projects/kd-rails/activerecord/lib/active_record/inheritance.rb:61:in `new'
        /home/kd/projects/kd-rails/activerecord/lib/active_record/persistence.rb:50:in `create!'
        /home/kd/projects/kd-rails/activerecord/test/cases/persistence_test.rb:913:in `test_save_touch_false'

    4522 runs, 12460 assertions, 0 failures, 1 errors, 4 skips
    ```

    After:
      `bundle exec rake mysql2:test`

    ```
       Finished in 135.785086s, 33.3026 runs/s, 91.7774 assertions/s.

       4522 runs, 12462 assertions, 0 failures, 0 errors, 4 skips
    ```
2015-03-31 12:14:03 +05:30
Guillermo Iguaran
151aa690a2 Merge pull request #19594 from radar/require-module-delegation
Require Module#delegate core ext in ActiveModel::Naming
2015-03-30 19:56:57 -05:00
Ryan Bigg
b6bf58c220 Require Module#delegate core ext in ActiveModel::Naming 2015-03-31 11:41:16 +11:00
Rafael Mendonça França
a408957613 Merge pull request #19592 from adimitri/activerecord-find-ambiguity
Combine complementary AR #find doc lines
2015-03-30 15:23:37 -03:00
Alexander Dimitriyadi
868816734d [ci skip] Combine complementary AR #find doc lines 2015-03-30 14:07:55 -04: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
7131f6ba22 Merge pull request #19021 from morgoth/activemodel-errors-refactoring
Simplify and alias ActiveModel::Errors methods where possible
2015-03-30 13:47:30 -03:00
Rafael Mendonça França
b5c35023bd Revert "Remove Array#inquiry"
This reverts commit 9420de59f5b7f5ceac77e28e6c326ec145f71f80.

Reason: Turns out we want to keep this method.
2015-03-30 13:38:13 -03:00
Hendy Tanata
b016533d5b Add missing "of" to testing guide. 2015-03-30 09:15:54 -07:00
Matthew Draper
cb01246721 Merge pull request #19034 from jvanbaarsen/explicit-job-base-class
Add explicit base class for ActiveJob jobs
2015-03-30 23:04:25 +10:30
Matthew Draper
ffd2f085a5 Merge branch 'kirs' 2015-03-30 17:06:09 +10:30
Rafael Mendonça França
e2a96c0712 Merge pull request #19587 from rails/rm-sprockets-3
Test using sprockets 3
2015-03-29 23:22:27 -03:00
Rafael Mendonça França
a8225eeec2 Test using sprockets 3 2015-03-29 22:58:32 -03:00
Rafael Mendonça França
6b53283051 Merge pull request #19581 from kirs/bin-deprecation-version
Replace `in Rails 4` with `in Rails %version%` in deprecation message
2015-03-29 20:22:26 -03:00
Rafael Mendonça França
77d9a8e3da Merge pull request #19585 from sgrif/sg-deprecate-tokenizer
Deprecate the `:tokenizer` option to `validates_length_of`
2015-03-29 20:11:25 -03:00
Sean Griffin
1c341eb7cb Deprecate the :tokenizer option to validates_length_of
As demonstrated by #19570, this option is severely limited, and
satisfies an extremely specific use case. Realistically, there's not
much reason for this option to exist. Its functionality can be trivially
replicated with a normal Ruby method. Let's deprecate this option, in
favor of the simpler solution.
2015-03-29 16:34:01 -06:00
Kir Shatrov
09d2623783 Switch to bin/rails test in testing guide
rails/rails#18305
2015-03-30 00:11:02 +03:00
Kir Shatrov
9a3ba6cd8b Replace in Rails 4 with in Rails %version% in deprecation message 2015-03-29 23:59:15 +03:00
Sean Griffin
01421d5b62 Clarify the role of ActiveRecord::Core.encode_with
Fixes #19568
2015-03-29 14:10:20 -06:00
Sean Griffin
445c12f7df Reduce memory usage when loading types in PG
We were never clearing the `PG::Result` object used to query the types
when the connection is first established. This would lead to a
potentially large amount of memory being retained for the life of the
connection.

Investigating this issue also revealed several low hanging fruit on the
performance of these methods, and the number of allocations has been
reduced by ~90%.

Fixes #19578
2015-03-29 13:54:39 -06:00
Zachary Scott
e8a334a9ee Merge pull request #19483 from yui-knk/fix/getting_started
[ci skip] Fix an object of `reference`
2015-03-29 12:52:19 -07:00
Zachary Scott
a5f25474a1 Merge pull request #19575 from y-yagi/fix_batches_test
use correct method in batches test
2015-03-29 11:28:32 -07:00
yuuji.yaginuma
5341cbcdc1 use correct method in batches test 2015-03-29 21:19:46 +09:00
Max Holder
2a5bb9d56e Print bundle install output in rails new as soon as it's available
Previously, running `rails new` would not print any of the output from
`bundle install` until all the gems had finished installing. This made
it look like the generator was hanging at the `bundle install` step.

This commit switches to using `system` so that the bundle command can
output as it needs to.

This has the added benefit of including output bundler produces on
standard error, which the previous code ignored since backticks only
capture standard out. This is not a big deal right now since bundler
does not currently print errors to standard error, but that may change
in the future (see: bundler/bundler/issues/3353).
2015-03-28 09:16:13 -04:00
Xavier Noria
8798788c65 Merge pull request #19544 from shuhei/fix-parameters-const-missing
Return super in ActionController::Parameters.const_missing
2015-03-28 10:01:25 +01:00
Jon Atack
676514c082 [skip ci] Fix counter_cache in the Rails Guides
In the AR Associations Guide, this PR fixes:

- The counter_cache declaration is now shown only in the `belongs_to`
association.

- The docs stated that the counter_cache declaration needs to be on the
`has_many` side; now corrected to the `belongs_to` side.

- Split the custom column explanation out to a separate paragraph.

- Simplify the NOTE because it is true both with and without a custom
column name.
2015-03-28 11:23:11 +05:30
Shuhei Kagawa
1b0526eaac Return super in ActionController::Parameters.const_missing
The current implementation of ActionController::Parameters.const_missing
returns `ActionController::Parameters.always_permitted_parameters` even
if its `super` returns a constant without raising error. This prevents its
subclass in a autoloading module/class from taking advantage of
autoloading constants.

    class SomeParameters < ActionController::Parameters
      def do_something
        DefinedSomewhere.do_something
      end
    end

In the code above, `DefinedSomewhere` is to be autoloaded with
`Module.const_missing` but `ActionController::Parameters.const_missing`
returns `always_permitted_parameters` instead of the autoloaded
constant.

This pull request fixes the issue respecting `const_missing`'s `super`.
2015-03-28 10:40:58 +09:00
Rafael Mendonça França
8bf2825205 Remove circular require 2015-03-27 16:58:49 -03:00