aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Clarify intentions around method redefinitionsMatthew Draper2017-09-011-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use remove_method or remove_possible_method just before a new definition: at best the purpose is unclear, and at worst it creates a race condition. Instead, prefer redefine_method when practical, and silence_redefinition_of_method otherwise.
* | | Merge pull request #30377 from keepcosmos/delegate-missing-methodsMatthew Draper2017-08-312-4/+4
|\ \ \ | | | | | | | | Delegate :rindex, :slice, :rotate(missing) to 'records'
| * | | Delegate :rindex, :slice, :rotate to 'records'keepcosmos2017-08-242-4/+4
| | | |
* | | | Merge pull request #30392 from koic/unify_source_control_keep_file_nameMatthew Draper2017-08-311-0/+0
|\ \ \ \ | | | | | | | | | | Unify the internal source control .keep file name
| * | | | Unify the internal source control .keep file nameKoichi ITO2017-08-241-0/+0
| |/ / /
* | | / Fix `can't modify frozen String` error in `DatabaseTasks`yuuji.yaginuma2017-08-304-2/+37
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without this, `db:structure:dump` task raises an error as follwing: ``` can't modify frozen String activerecord/lib/active_record/tasks/sqlite_database_tasks.rb:77:in `run_cmd_error' activerecord/lib/active_record/tasks/sqlite_database_tasks.rb:72:in `run_cmd' activerecord/lib/active_record/tasks/sqlite_database_tasks.rb:52:in `structure_dump' activerecord/lib/active_record/tasks/database_tasks.rb:219:in `structure_dump' activerecord/lib/active_record/railties/databases.rake:279:in `block (3 levels) in <main>' railties/lib/rails/commands/rake/rake_command.rb:23:in `block in perform' railties/lib/rails/commands/rake/rake_command.rb:20:in `perform' railties/lib/rails/command.rb:48:in `invoke' railties/lib/rails/commands.rb:18:in `<main>' ```
* | | Merge pull request #30439 from prathamesh-sonpatki/changelog-30360Ryuta Kamizono2017-08-291-0/+5
|\ \ \ | | | | | | | | Added CHANGELOG for #30360 [ci skip]
| * | | Added CHANGELOG for #30360 [ci skip]Prathamesh Sonpatki2017-08-281-0/+5
| | | |
* | | | Merge pull request #30445 from prathamesh-sonpatki/fix-30441Kasper Timm Hansen2017-08-281-0/+2
|\ \ \ \ | | | | | | | | | | Clarify that bulk option is supported only by MySQL
| * | | | Clarify that bulk option is supported only by MySQL [ci skip]Prathamesh Sonpatki2017-08-291-0/+2
| |/ / / | | | | | | | | | | | | - Closes #30441
* | | | "models/reader" is no longer used in `autosave_association_test.rb`Ryuta Kamizono2017-08-281-1/+0
| | | |
* | | | Address `test_assign_ids_for_through_a_belongs_to` failureRyuta Kamizono2017-08-281-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If `:readers` fixture is loaded before the test, it will be failed. Use `firm.developer_ids` instead because we don't have `:contracts` fixture for now. https://travis-ci.org/rails/rails/jobs/268976230#L729
* | | | `@previous_reflection.options[:source_type]` in `PolymorphicReflection` is ↵Ryuta Kamizono2017-08-281-10/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | always true Because `add_as_polymorphic_through` is only called when `options[:source_type]` is true.
* | | | Remove unused `RuntimeReflection#alias_candidate`Ryuta Kamizono2017-08-281-4/+0
| | | | | | | | | | | | | | | | `RuntimeReflection#alias_candidate` is no longer used since 0408e212.
* | | | Should be appear deprecation message for every call (#29649)Ryuta Kamizono2017-08-272-8/+1
| | | | | | | | | | | | Context: https://github.com/rails/rails/pull/29619#discussion_r125158589
* | | | Omit the default limit for float columns (#28041)Ryuta Kamizono2017-08-273-5/+10
| | | |
* | | | Prefer to place a table options before `force: :cascade` (#28005)Ryuta Kamizono2017-08-275-11/+10
|/ / / | | | | | | | | | | | | | | | I was added a table options after `force: :cascade` in #17569 for not touching existing tests (reducing diff). But `force: :cascade` is not an important information. So I prefer to place a table options before `force: :cascade`.
* | | Use tt in doc for ActiveRecord [ci skip]Yoshiyuki Hirano2017-08-276-20/+20
| | |
* | | Fix random CI failure due to non-deterministic sorting orderRyuta Kamizono2017-08-261-6/+6
| | | | | | | | | | | | https://travis-ci.org/rails/rails/jobs/268599781#L784
* | | Merge pull request #30403 from yhirano55/fix_broken_doc_for_active_recordRyuta Kamizono2017-08-267-7/+7
|\ \ \ | | | | | | | | Fix broken doc for Active Record [ci skip]
| * | | Fix broken doc for Active Record [ci skip]Yoshiyuki Hirano2017-08-257-7/+7
| | | |
* | | | Add :nodoc: for ActiveRecord::AttributeMethods [ci skip]Yoshiyuki Hirano2017-08-263-3/+3
| | | |
* | | | Should work inverse association when eager loadingRyuta Kamizono2017-08-254-15/+24
|/ / / | | | | | | | | | | | | | | | | | | This regression was caused by caa178c1. The block for `set_inverse_instance` should also be passed to join dependency. Fixes #30402.
* | | Address `test_after_save_callback_with_autosave` failureYasuo Honda2017-08-241-0/+4
| | | | | | | | | | | | | | | | | | | | | when other `AutomaticInverseFindingTests` load `:comments` fixture but does not load `:posts`. Refer #30385 for similar issue
* | | Remove unused returning value `stream`Ryuta Kamizono2017-08-241-2/+0
| | |
* | | Merge pull request #30337 from kamipo/refactor_schema_dumperRyuta Kamizono2017-08-2415-56/+54
|\ \ \ | | | | | | | | Refactor `SchemaDumper` to make it possible to adapter specific customization
| * | | Refactor `SchemaDumper` to make it possible to adapter specific customizationRyuta Kamizono2017-08-2213-38/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently `SchemaDumper` is only customizable for column options. But 3rd party connection adapters (oracle-enhanced etc) need to customizable for table or index dumping also. To make it possible, I introduced adapter specific `SchemaDumper` classes for that.
| * | | Remove deprecated `#migration_keys`Ryuta Kamizono2017-08-225-19/+4
| | | |
* | | | Remove unnecessary fixture loadingRyuta Kamizono2017-08-241-5/+1
| |/ / |/| |
* | | Merge pull request #30365 from yahonda/require_post_before_commentRyuta Kamizono2017-08-231-0/+3
|\ \ \ | | | | | | | | `counter_cache` requires association class before `attr_readonly`
| * | | `counter_cache` requires association class before `attr_readonly`Yasuo Honda2017-08-231-0/+3
| |/ / | | | | | | | | | | | | There were similar pull requests #26370 #27575 fixed by different way by moving `require "models/post"` before `require "models/comment"`
* | | Merge pull request #28991 from yahonda/load_authors_and_author_addressesRyuta Kamizono2017-08-234-4/+4
|\ \ \ | | | | | | | | Load :author_addresses fixture to keep data integrity with :authors
| * | | Load both `:authors` and `:author_addresses` to keep data integrityYasuo Honda2017-08-224-4/+4
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `:authors` has a foreign key to `:author_addresses`. If only `:authors` fixture loaded into the database which supports foreign key and checks the existing data when enabling foreien keys like Oracle, it raises the following error `ORA-02298: cannot validate (ARUNIT.FK_RAILS_94423A17A3) - parent keys not found` It is because there is no parent data exists in `author_addresses` table. Here are how other database with foreign key support works: - MySQL does not check the existing data when enabling foreign key by `foreign_key_checks=1` https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_foreign_key_checks > Setting foreign_key_checks to 1 does not trigger a scan of the existing table data. Therefore, rows added to the table while foreign_key_checks=0 will not be verified for consistency. - PostgreSQL database itself has a feature to check existing data when enabling foreign key and discussed at #27636, which is reverted.
* | | Merge pull request #30360 from gcourtemanche/transaction_timedoutRafael França2017-08-223-0/+14
|\ \ \ | |/ / |/| | Add TransactionTimeout for MySQL error code 1205
| * | Add TransactionTimeout for MySQL error code 1205Gabriel Courtemanche2017-08-223-0/+14
| | |
* | | Automatically guess the inverse associations for STIyui-knk2017-08-223-2/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ActiveRecord associations automatically guess the inverse associations. But this feature does not work correctly on assoctions for STI. For example, before this commit ``` class Post < ActiveRecord::Base belongs_to :author end class SpecialPost < Post; end class Author < ActiveRecord::Base has_many :posts has_many :special_posts end ``` `author.posts.first.author` works correctly, but `author.special_posts.first.author` does not work correctly.
* | | Merge pull request #30354 from ↵Ryuta Kamizono2017-08-2212-13/+13
|\ \ \ | | | | | | | | | | | | | | | | yhirano55/use_https_instead_of_http_in_activerecord [activerecord] Update links to use https instead of http [ci skip]
| * | | Update links to use https instead of http [ci skip]Yoshiyuki Hirano2017-08-2212-13/+13
| |/ /
* / / Update MIT licenses link [ci skip]Yoshiyuki Hirano2017-08-221-2/+2
|/ /
* | Prevent extra `SET time zone` in `configure_connection` (#28413)Ryuta Kamizono2017-08-212-6/+15
| | | | | | | | | | | | | | | | `SET time zone 'value'` is an alias for `SET timezone TO 'value'`. https://www.postgresql.org/docs/current/static/sql-set.html So if `variables["timezone"]` is specified, it is enough to `SET timezone` once.
* | Require "active_support/core_ext/hash/compact" for `compact!`Ryuta Kamizono2017-08-211-0/+2
| |
* | Prefer formatted number as schema version [ci skip]Ryuta Kamizono2017-08-211-1/+1
| |
* | Place `update_table_definition` consistently in `SchemaStatements`Ryuta Kamizono2017-08-216-12/+12
| |
* | Don't expose `prepare_column_options`Ryuta Kamizono2017-08-213-52/+30
| | | | | | | | | | This is only used for the internal `column_spec` and `column_spec_for_primary_key`.
* | Register integer types limit correctly for postgresql adapter (#26386)Ryuta Kamizono2017-08-201-15/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | currently integer types extracts the `limit` from `sql_type`. But the lookup key of type map is the `oid` in postgresql adapter. So in most case `sql_type` is passed to `extract_limit` as `""` and `limit` is extracted as `nil`. https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L445 In mysql2 adapter, `limit` is registered correctly without extracting from `sql_type`. https://github.com/rails/rails/blob/v5.1.0.beta1/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L678-L682 Postgresql adapter should also be registered correctly. ``` ruby conn = ActiveRecord::Base.connection conn.select_all("SELECT 1::smallint, 2::integer, 3::bigint").column_types.map do |name, type| [name, type.limit] end ``` Before: ``` ruby # => [["int2", nil], ["int4", nil], ["int8", nil]] ``` After: ``` ruby # => [["int2", 2], ["int4", 4], ["int8", 8]] ```
* | Fix `can't modify frozen String` error in an AR testKoichi ITO2017-08-191-2/+2
| |
* | Improve `migration/column_attributes_test.rb` (#25286)Ryuta Kamizono2017-08-181-3/+17
| | | | | | | | | | * Test `test_unabstracted_database_dependent_types` for `PostgreSQLAdapter` * Add `test_change_column_with_new_precision_and_scale` for `SQLite3Adapter` * This test case and comment was lost at 28bb02a78fd47527bb7a208d01a4594bb212812c
* | Add deterministic sorting order for `test_taking_with_a_number`Ryuta Kamizono2017-08-181-1/+9
| | | | | | | | | | | | Otherwise random CI failure will be caused. https://travis-ci.org/rails/rails/jobs/265848046#L777
* | Restore the ability that SQL with binds for `insert`, `update`, and `delete` ↵Ryuta Kamizono2017-08-182-6/+38
| | | | | | | | | | | | | | | | (#29944) Since 213796f, it was lost the ability that SQL with binds for `insert`, `update`, and `delete` (like `select_all`). This restores the ability because `insert`, `update`, and `delete` are public API, so it should not be removed without deprecation.
* | Add test cases that class level `destroy`, `delete`, and `update` are ↵Ryuta Kamizono2017-08-181-3/+33
| | | | | | | | | | | | | | affected by scoping (#29997) I tried to change the expectation in #29976, but it is expected behavior at least for now. So I added the test cases to prevent anyone change the expectation.