Commit Graph

13639 Commits

Author SHA1 Message Date
Yves Senn
c0939a5038 Merge pull request #19763 from jonatack/fix-typos-in-docs
Fix typos and improve the documentation
2015-04-15 13:35:56 +02: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
Yves Senn
5f00ed10dd Revert "Merge pull request #19755 from yuki24/activerecord/support-for-set"
This reverts commit 524d40591eaa2f4d007409bfad386f6b107492eb, reversing
changes made to 34d3a6095100245283861ef480a54d0643bbee4c.

Reasoning behind the revert are in the PR discussion:
https://github.com/rails/rails/pull/19755

- This means that types can no longer cast to/from `Set`, and reasonably
  work with `where` (we already have this problem for `array`/`json`
  types on pg)
- This adds precedent for every other `Enumerable`, and we can't target
  `Enumerable` directly.
- Calling `to_a` on a `Set` is reasonable.
2015-04-15 09:10:00 +02:00
Yves Senn
524d40591e Merge pull request #19755 from yuki24/activerecord/support-for-set
Add support for Set to Relation#where
2015-04-14 08:57:10 +02: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
Yuki Nishijima
50cae600bd Add support for Set to Relation#where
Previously `#where` used to treat `Set`objects as nil, but now it treats
them as an array:

  set = Set.new([1, 2])
  Author.where(:id => set)
  # => SELECT "authors".* FROM "authors" WHERE "authors"."id" IN (1, 2)
2015-04-13 20:13:37 -07: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
Yves Senn
ec59d6ec84 Merge pull request #19741 from greysteil/add-note-about-partial-index-support
Document that partial indexes are only supported by Postgres and SQLite.
2015-04-13 09:48:04 +02:00
Grey Baker
e91c4339e4 Document that partial indexes are only supported by Postgres and SQLite.
Fixes #18106
2015-04-13 09:33:48 +02:00
Zachary Scott
e83c398f60 Add a note regarding add_column restricted API [ci skip]
We should document current behavior, and this is design of API for now.

Closes #17597
2015-04-12 21:01:55 -07:00
Zachary Scott
93d2eeaad5 Apply edits from @senny to close #19397 [ci skip] 2015-04-12 18:17:31 -07:00
Zachary Scott
055d9993b5 Merge branch 'patch-1' 2015-04-12 17:58:56 -07:00
wingfire
a9f2c124af Enhance documentation of pluck with a hint to ids [ci skip]
Documentation is giving an example that can be replaced by a more dry command.
Give a hint that ids can be used instead of pluck(:id).
2015-04-12 17:57:00 -07:00
Matthew Draper
c7b25b842c Fix (intermittent?) test failure
We don't actually need to enumerate the possible types here any more;
that dates back to before e105e599e706780905d4c348394da989de3b200f, when
they were symbols, and indistinguishable from other options.
2015-04-13 08:32:35 +09:30
Robin Dupret
d21c688522 Merge pull request #19721 from vngrs/validates_presence_of_missing_note
Missing note on validates_presence_of validation [ci skip]
2015-04-11 22:43:36 +02:00
Mehmet Emin İNAÇ
29986b0d41 Missing note on validates_presence_of validation [ci skip]
Without this note, someone can misunderstand the usage of validates_presence_of method

add missing note for the validates_presence_of
2015-04-11 23:24:36 +03:00
Prem Sichanugrist
3e482f2956
Use use_transactional_tests in Active Record
`use_transactional_fixtures` was deprecated in favor of
`use_transactional_tests` in Rails 5.0. This removes one warning while
running test suite.
2015-04-10 16:51:02 -04:00
Simon Stemplinger
41b2ba5926 fix documentation for SchemaStatements#add_foreign_key
The implementation of the generation of the foreign key name was changed
between Rails 4.2.0 and 4.2.1 from a random to a deterministic behavior,
however the documentation still describes the old randomized behavior.
2015-04-08 22:02:00 +02:00
Arthur Neves
8971389783
Batch touch parent records
[fixes #18606]

Make belongs_to use touch over touch_later when running the callbacks.

Add more tests and small method rename

Thanks Jeremy for the feedback.
2015-04-08 13:31:28 -04:00
Sean Griffin
67c2deeb4b Merge branch 'fix_uniqueness_validation_when_value_is_out_of_range' 2015-04-08 11:07:39 -06:00
Andrey Voronkov
1a36be390e Fix uniqueness validation with out of range value 2015-04-08 19:28:45 +03:00
Rafael Mendonça França
d69d662e65 Merge pull request #19680 from vngrs/make_join_model_name_const_private
Change join model name constant to private constant
2015-04-07 16:16:08 -03:00
Jeremy Kemper
bd51bbc028 Merge pull request #17574 from kamipo/charset_collation_options
Add charset and collation options support for MySQL string and text columns.
2015-04-07 09:40:16 -07:00
Mehmet Emin İNAÇ
b34c98153f Change join model name constant to private constant
This will resolve the fixme message which is about making constant invisible.
2015-04-07 11:29:04 +03:00
Rafael Mendonça França
d5f80655f9 Merge pull request #19647 from codeout/association_update
Fix a regression introduced by removing unnecessary db call when replacing
2015-04-06 19:17:54 -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
Rafael Mendonça França
a956ec9640 No need to document drop_table in the PostgreSQLAdapter
It behaves in the same way that the abstract adapter.

[ci skip]
2015-04-06 17:38:53 -03:00
Mehmet Emin İNAÇ
acd21df91a change the explanation of :if_exists option [ci skip] 2015-04-06 19:33:36 +03:00
Mehmet Emin İNAÇ
1a53549901 drop_table method documentation for mysql and postgresql adapters [ci skip] 2015-04-06 16:15:15 +03:00
Yves Senn
51eacc71c7 Merge pull request #19652 from vngrs/pluralize_foreign_key_table_name_bug
use singular table name if pluralize_table_names is setted as false whil...
2015-04-06 10:42:44 +02:00
Mehmet Emin İNAÇ
8c1180731f use singular table name if pluralize_table_names is setted as false while creating foreign key
test case for use singular table name if pluralize_table_names is setted as false while creating foreign key

refactor references foreign key addition tests

use singular table name while removing foreign key

merge foreign key singular table name methods

remove unnecessary drop table from test
2015-04-06 11:10:24 +03:00
eileencodes
191facc857 Don't invoke sql_runtime if logger is not set to info
`sql_runtime` was getting invoked even when the logger was set to fatal.
This ensures that does not happen by checking that the logger is set to
info level before logging the view runtime.

This reduces the number of times `sql_runtime` is called for integration
tests with a fatal logger from 6 to 2.
2015-04-04 09:21:18 -04:00
Shintaro Kojima
e646d3bf57 Fix a regression introduced by removing unnecessary db call when replacing
When replacing a has_many association with the same one, there is nothing to do with database but a setter method should still return the substituted value for backward compatibility.
2015-04-04 12:48:36 +00:00
Koen Punt
9452dc9c0a remove duplicates 2015-04-03 00:00:30 +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
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
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
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
Alexander Dimitriyadi
868816734d [ci skip] Combine complementary AR #find doc lines 2015-03-30 14:07:55 -04: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
yuuji.yaginuma
5341cbcdc1 use correct method in batches test 2015-03-29 21:19:46 +09:00
Jon Atack
fe6de0f023 [skip ci] Improve warn_on_records_fetched documentation
- ‘dection’ -> ‘detection’

- ‘exceeds threshold’ -> ‘exceeds the threshold’

- Other minor improvements.
2015-03-27 15:36:44 +05:30
Sean Griffin
cd09261846 Partially merge #17650
Merges 647eb2cf1cd65b0391e3584361f0fc76246e64f3. The pull request as a
whole is quite large, and I'm reviewing the smaller pieces individually.
2015-03-26 17:41:47 -06:00
Sean Griffin
3b50a7a3e1 Partially merge #17650
Merges 1d8d5a74b81b8aab1f5e6d233d509a92525ed4e1. The pull request as a
whole is quite large, and I'm reviewing the smaller pieces individually.
2015-03-26 17:36:42 -06:00
Rafael Mendonça França
8b451e3a31 Merge pull request #18846 from hundredwatt/feat/warn-on-result-set-size
Add `config.active_record.warn_on_result_set_size` option
2015-03-26 17:21:36 -03: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
Jason Nochlin
4d6fbe2934 Add config.active_record.warn_on_records_fetched_greater_than option
When set to an integer, a warning will be logged whenever a result set
larger than the specified size is returned by a query. Fixes #16463

The warning is outputed a module which is prepended in an initializer,
so there will be no performance impact if
`config.active_record.warn_on_records_fetched_greater_than` is not set.
2015-03-25 16:50:11 -04:00