aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | | Correctly dump `:options` on `create_table` for MySQLRyuta Kamizono2015-05-032-0/+84
| |/ / / / /
* | | | | | Merge pull request #19987 from kamipo/move_postgresql_specific_schemaRafael Mendonça França2015-05-032-14/+11
|\ \ \ \ \ \ | | | | | | | | | | | | | | Move PostgreSQL specific schema to postgresql_specific_schema.rb
| * | | | | | Move PostgreSQL specific schema to postgresql_specific_schema.rbRyuta Kamizono2015-05-032-14/+11
| | |/ / / / | |/| | | |
* / | | | | PostgreSQL: `:collation` support for string and text columnsRyuta Kamizono2015-05-041-0/+53
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example: create_table :foos do |t| t.string :string_en, collation: 'en_US.UTF-8' t.text :text_ja, collation: 'ja_JP.UTF-8' end
* / / / / Remove unused requireRyuta Kamizono2015-05-032-2/+0
|/ / / /
* | | | Merge pull request #19546 from DianthuDia/fix_unscope_for_less_thanYves Senn2015-04-281-0/+12
|\ \ \ \ | | | | | | | | | | | | | | | Fix unscope for less than
| * | | | Fix unscope for less thanTAKAHASHI Kazuaki2015-03-271-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Code such as the following will be corrected. Developer.where(id: -Float::INFINITY...2).unscope(where: :id)
* | | | | Merge pull request #19718 from eagletmt/find_by-without-argYves Senn2015-04-281-0/+8
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Raise ArgumentError when find_by receives no arguments
| * | | | | Raise ArgumentError when find_by receives no argumentsKohei Suzuki2015-04-111-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It fixes the strange error saying undefined method `take'. ``` RelationTest#test_find_by_without_arg_behaves_same_with_find_by({}): NoMethodError: undefined method `take' for #<ActiveRecord::QueryMethods::WhereChain:0x007f9c55db1d68> ```
* | | | | | test, for `create_table` and `foreign_key: true` no-op. Closes #19794.Yves Senn2015-04-271-0/+20
| |_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a test-case to make sure that `create_table` with a `foreign_key: true` and an adapter without foreign key support does not blow up. Motivated by #19794. Originating from: https://github.com/rails/rails/commit/99a6f9e60ea55924b44f894a16f8de0162cf2702#commitcomment-10855210
* | | | | Silence warning from MySQL::Error object in testPrem Sichanugrist2015-04-231-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running Active Record MySQL test, this warning is printed in the console: warning: instance variable errno not initialized It turns out that this is a warning from `mysql` gem in MySQL::Error object. However, since the `mysql` gem is no longer maintained, and there won't be a newer version, it make sense for us to just silence this warning to make the output cleaner.
* | | | | Merge pull request #18880 from mudge/timestamp-index-bugRafael Mendonça França2015-04-231-0/+11
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Fix missing index when using timestamps with index
| * | | | | Fix missing index when using timestamps with indexPaul Mucur2015-04-151-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `index` option used with `timestamps` should be passed to both `column` definitions for `created_at` and `updated_at` rather than just the first. This was happening because `Hash#delete` is used to extract the `index` option passed to `timestamps`, thereby mutating the `options` hash in-place. Now take a copy of the `options` before deleting so that the original is not modified.
* | | | | | Rename association option :class to :anonymous_classAndrew White2015-04-215-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 1f006c an option was added called :class to allow passing anonymous classes to association definitions. Since using :class instead of :class_name is a fairly common typo even amongst experienced developers this can result in hard to debug errors arising in raise_on_type_mismatch? To fix this we're renaming the option from :class to :anonymous_class as that is a more correct description of what the option is for. Since this was an internal, undocumented option there is no need for a deprecation. Fixes #19659
* | | | | | Merge pull request #19783 from vngrs/raise_error_on_touch_if_object_is_staleSean Griffin2015-04-191-0/+10
|\ \ \ \ \ \ | | | | | | | | | | | | | | Raise StaleObjectError if touched object is stale and locking is enabled
| * | | | | | Raise StaleObjectError if touched object is stale and locking is enabledMehmet Emin İNAÇ2015-04-191-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #19776 change test variable names and use more verbose on method less verbose use _read_attribute instead of send
* | | | | | | Autosave existing records on HMT associations when the parent is newSean Griffin2015-04-181-0/+10
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To me it seems like this should only be the case if `autosave: true` is set on the association. However, when implemented that way, it caused issues with has many associations, where we have explicit tests stating that child records are updated when the parent is new, even if autosave is not set (presumably to update the parent id, but other changed attributes would be persisted as well). It's quirky, but at least we should be consistently quirky. This constitutes a minor but subtle change in behavior, and therefore should not be backported to 4.2 and earlier. Fixes #19782
* | | | | | Merge pull request #19763 from jonatack/fix-typos-in-docsYves Senn2015-04-152-3/+3
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Fix typos and improve the documentation
| * | | | | Fix typos and improve the documentationJon Atack2015-04-152-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | Revert "Merge pull request #19755 from yuki24/activerecord/support-for-set"Yves Senn2015-04-151-10/+0
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | Merge pull request #19755 from yuki24/activerecord/support-for-setYves Senn2015-04-141-0/+10
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Add support for Set to Relation#where
| * | | | | Add support for Set to Relation#whereYuki Nishijima2015-04-131-0/+11
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* | | / / Fix (intermittent?) test failureMatthew Draper2015-04-131-1/+1
| |_|/ / |/| | | | | | | | | | | | | | | | | | | 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.
* | | | Use `use_transactional_tests` in Active RecordPrem Sichanugrist2015-04-102-2/+2
|/ / / | | | | | | | | | | | | | | | `use_transactional_fixtures` was deprecated in favor of `use_transactional_tests` in Rails 5.0. This removes one warning while running test suite.
* | | Batch touch parent recordsArthur Neves2015-04-082-0/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [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.
* | | Merge branch 'fix_uniqueness_validation_when_value_is_out_of_range'Sean Griffin2015-04-081-0/+25
|\ \ \
| * | | Fix uniqueness validation with out of range valueAndrey Voronkov2015-04-081-0/+25
|/ / /
* | | Merge pull request #17574 from kamipo/charset_collation_optionsJeremy Kemper2015-04-074-18/+118
|\ \ \ | |_|/ |/| | | | | Add charset and collation options support for MySQL string and text columns.
| * | Add `:charset` and `:collation` options support for MySQL string and text ↵Ryuta Kamizono2015-03-064-18/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | columns Example: create_table :foos do |t| t.string :string_utf8_bin, charset: 'utf8', collation: 'utf8_bin' t.text :text_ascii, charset: 'ascii' end
* | | Merge pull request #19647 from codeout/association_updateRafael Mendonça França2015-04-061-0/+2
|\ \ \ | | | | | | | | Fix a regression introduced by removing unnecessary db call when replacing
| * | | Fix a regression introduced by removing unnecessary db call when replacingShintaro Kojima2015-04-041-0/+2
| | | | | | | | | | | | | | | | 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.
* | | | use singular table name if pluralize_table_names is setted as false while ↵Mehmet Emin İNAÇ2015-04-061-0/+22
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge pull request #19586 from mechanicles/fix-eager-loading-for-find-methodsRafael Mendonça França2015-03-311-0/+17
|\ \ \ | | | | | | | | Fix eager loading association using default_scope for finder methods.
| * | | Fix eager loading association using default_scope for finder methods.Santosh Wadghule2015-03-311-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | - 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)'.
* | | | use Model.reset_column_information to clear table cache connection wide.Kuldeep Aggarwal2015-03-312-2/+4
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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 ```
* | / use correct method in batches testyuuji.yaginuma2015-03-291-2/+3
| |/ |/|
* | Partially merge #17650Sean Griffin2015-03-265-14/+14
|\ \ | | | | | | | | | | | | Merges 1d8d5a74b81b8aab1f5e6d233d509a92525ed4e1. The pull request as a whole is quite large, and I'm reviewing the smaller pieces individually.
| * | PostgreSQL, Fix OID based type casts in C for primitive types.Lars Kanis2015-03-255-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The type map was introduced in aafee23, but wasn't properly filled. This mainly adjusts many locations, that expected strings instead of integers or boolean. add_pg_decoders is moved after setup of the StatementPool, because execute_and_clear could potentially make use of it.
* | | Add `config.active_record.warn_on_records_fetched_greater_than` optionJason Nochlin2015-03-251-0/+28
|/ / | | | | | | | | | | | | | | | | 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.
* | Merge pull request #19503 from jasoncodes/no-psqlrcYves Senn2015-03-251-2/+2
| | | | | | | | Avoid loading user's psqlrc when loading test structure
* | Merge pull request #19452 from ↵Carlos Antonio da Silva2015-03-241-0/+11
|\ \ | | | | | | | | | | | | | | | pinglamb/fix-referencing-wrong-alias-when-joining-tables-of-has-many-through-association Fix referencing wrong aliases while joining tables of has many through association
| * | Fix referencing wrong aliases while joining tables of has many throughpinglamb2015-03-221-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | association While joining table of has_many :through association, ActiveRecord will use the actual table name instead of through-join alias. It results with a wrong SQL and exception is raised. This only happens when calculation methods like #count is called. This issue is affecting Rails 4.1.x and 4.2.x as well.
* | | Merge pull request #19493 from larskanis/add_infinity_testYves Senn2015-03-241-0/+9
|\ \ \ | | | | | | | | PostgreSQL, Add test case for "Infinity" string assignment to float columns
| * | | PostgreSQL, Add test case for "Infinity" string assignment to float columns.Lars Kanis2015-03-221-0/+9
| |/ / | | | | | | | | | This is implemented in Type::Float, but not tested, so far.
* | | remove old unavailable link with relevant fixGaurav Sharma2015-03-232-3/+1
| | |
* | | Make sure to persist a newly-nil serialized valueMatthew Draper2015-03-231-0/+10
|/ / | | | | | | | | | | | | The subtype will (quite reasonably) ignore the possibility that it has `changed_in_place?` by becoming nil. Fixes #19467
* | Delegate limit to subtypewallerjake2015-03-212-0/+9
| | | | | | | | | | | | | | | | | | | | As described here https://github.com/rails/rails/issues/19420. When using the Postgres BigInt[] field type the big int value was not being translated into schema.rb. This caused the field to become just a regular integer field when building off of schema.rb. This fix will address this by delegating the limit from the subtype to the Array type. https://github.com/rails/rails/issues/19420
* | Revert "Merge pull request #19404 from dmathieu/remove_rack_env"Jeremy Kemper2015-03-201-0/+34
| | | | | | | | | | | | | | Preserving RACK_ENV behavior. This reverts commit 7bdc7635b885e473f6a577264fd8efad1c02174f, reversing changes made to 45786be516e13d55a1fca9a4abaddd5781209103.
* | Don't cast nil to string in pg enumsSean Griffin2015-03-191-0/+8
| | | | | | | | Fixes #19389.
* | don't fallback to RACK_ENV when RAILS_ENV is not presentDamien Mathieu2015-03-191-34/+0
| |