aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
Commit message (Collapse)AuthorAgeFilesLines
* #where fails if opts.responds_to?(:==) unexpectedlySamuel Williams2015-09-051-1/+1
| | | Sometimes opts passed in might respond to ==, e.g. `Arel::Nodes::Grouping`. In this case, `opts == :chain` returns `Arel::Nodes::Equality` which causes odd behaviour. Prefer `if :chain == opts` which guarantees that `Symbol#==` would be invoked. Alternatively consider `eql?`.
* Merge pull request #21412 from yui-knk/feature/irreversible_migration_error_msgYves Senn2015-09-042-2/+77
|\ | | | | | | Add detailed error message to `IrreversibleMigration`
| * Add detailed error message to `IrreversibleMigration`yui-knk2015-08-301-1/+6
| |
| * [ci skip] Add comments for `IrreversibleMigration`yui-knk2015-08-291-0/+70
| |
| * Add detailed error message to `IrreversibleMigration`yui-knk2015-08-281-1/+1
| |
| * Add detailed error message to `IrreversibleMigration`yui-knk2015-08-281-1/+1
| |
* | Remove unnecessary require in associations_test.rbakihiro172015-09-031-1/+0
| |
* | Don't allocate a bunch of strings in `Relation::Merger`Sean Griffin2015-09-021-4/+8
| | | | | | | | | | | | Since the strings are dynamically computed from a constant, the actual strings we're creating are a known set. We can compute them ahead of time, and reduce the number of allocations in that method.
* | Respect scale of the column in the Decimal typeRafael Mendonça França2015-09-013-1/+36
| | | | | | | | [Rafael Mendonça França + Jean Boussier]
* | No need to get the exception variableRafael Mendonça França2015-09-011-6/+4
| |
* | Merge pull request #21318 from yahonda/pr21108Rafael Mendonça França2015-09-012-3/+7
|\ \ | | | | | | Support MySQL 5.7.8 which enables show_compatibility_56=off
| * | Support MySQL 5.7.8 which enables show_compatibility_56=offYasuo Honda2015-08-212-3/+7
| | |
* | | Inline uneccessary frozen string constantSean Griffin2015-08-311-3/+1
| | | | | | | | | | | | | | | | | | | | | We are only supporting Ruby 2.2 and later in Rails 5, so we do not need an actual constant here. Additionally, referencing a constant actually does a hash lookup (because constants are not constant in Ruby >_>). This will be marginally (likely immeasurable) faster. It is less ugly.
* | | Merge pull request #21432 from yui-knk/fix/what_change_method_can_reverseSean Griffin2015-08-301-1/+13
|\ \ \ | | | | | | | | [ci skip] Update what methods `Migration#change` can reverse
| * | | [ci skip] Update what methods `Migration#change` can reverseyui-knk2015-08-311-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Documentations and comments about what methods `Migration#change` can reverse is out of date. For example `change_column_default` is now reversible by this [commit](https://github.com/rails/rails/pull/20018). * Comments about `CommandRecorder` dose not match with Rails Guide. For example `add_foreign_key` is listed only on Rails Guide.
* | | | Merge pull request #21429 from yui-knk/fix/revert_disable_extensionSean Griffin2015-08-302-1/+34
|\ \ \ \ | |/ / / |/| | | Make revert of `disable_extension` to work
| * | | Make revert of `disable_extension` to workyui-knk2015-08-302-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | This is fix of #11826 which miss to add `disable_extension` to `ReversibleAndIrreversibleMethods`. So `CommandRecorder#method_missing` catches `change_column_default` and @delegate's method is called.
* | | | Merge branch 'master' of github.com:rails/docrailsVijay Dev2015-08-302-2/+2
|\ \ \ \ | |/ / / |/| | |
| * | | [ci skip] Capitalize commentsyui-knk2015-08-291-1/+1
| | | |
| * | | [ci skip] Fix file name generated by `rails generate`yui-knk2015-08-241-1/+1
| | | |
* | | | pg, `create_schema`, `drop_schema` and `rename_table` quote schema name.Yves Senn2015-08-284-10/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #21418. Previously schema names were not quoted. This leads to issues when a schema names contains a ".". Methods in `schema_statements.rb` should quote user input.
* | | | pg docs, `connection.tables` does not use the `name` argument.Yves Senn2015-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ci skip] Currently the `#tables` method does not make use of the `name` argument and always returns all the tables in the schema search path. However the docs suggest different behavior. While we should porbably adjust the implementation to provide this behavior, let's make the docs right for now (also for `4-2-stable`) and then implement the behavior on `master`.
* | | | PostgreSQL, add `:if_exists` to `#drop_schema`.Yves Senn2015-08-284-13/+30
| |_|/ |/| |
* | | no more require minitest mockGaurav Sharma2015-08-273-3/+0
| | |
* | | Merge pull request #21386 from ronakjangir47/remove_dupsRafael Mendonça França2015-08-264-4/+0
|\ \ \ | | | | | | | | Removed duplicate requires
| * | | Removed duplicate require ‘models/computer’Ronak Jangir2015-08-264-4/+0
| | | |
* | | | Merge pull request #21336 from yui-knk/refactor/to_use_getterRafael Mendonça França2015-08-261-7/+7
|\ \ \ \ | | | | | | | | | | Use `ActiveRecord::Migration#connection` instead of `@connection`
| * | | | Use `ActiveRecord::Migration#connection` instead of `@connection`yui-knk2015-08-231-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | `ActiveRecord::Migration` has `connetion` method so replace to use `connection` method to get `@connection` as much as possible
* | | | | Fix the unused variable warningakihiro172015-08-261-1/+0
| |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following warning. ```ruby warning: assigned but unused variable - index_definition ```
* | | | Merge pull request #21377 from ronakjangir47/remove_mocha_active_recordKasper Timm Hansen2015-08-2512-119/+153
|\ \ \ \ | | | | | | | | | | Removed mocha from Active Record Part 1
| * | | | Removed mocha from Active Record Part 1Ronak Jangir2015-08-2512-119/+153
| | | | |
* | | | | Merge pull request #21372 from yui-knk/fix/revert_change_column_defaultSantiago Pastorino2015-08-252-8/+41
|\ \ \ \ \ | | | | | | | | | | | | Make `change_column_default` to work
| * | | | | Make `change_column_default` to workyui-knk2015-08-252-8/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is fix of #20018 which removes `change_column_default` from array, so `CommandRecorder#method_missing` catches `change_column_default` and @delegate's method is called. This PR * fix this bug * define `ReversibleAndIrreversibleMethods` const making clear which this array means to prevent these miss
* | | | | | remove unused require ‘set’NehaGautam2015-08-251-1/+0
| | | | | |
* | | | | | Merge pull request #21074 from ↵Robin Dupret2015-08-251-3/+3
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | | | | | | | vrybas/rdoc-fix-typo-belongs-to-inverse-of-class-name RDoc: fix wrong model name `:inverse_of` with `:belongs_to` [ci skip]
| * | | | | RDoc: fix wrong model name `:inverse_of` with `:belongs_to` [ci skip]Vladimir Rybas2015-07-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's a typo in ActiveRecord associations RDocs. Wrong `Taggable` model name, instead of `Tagging` in example of using option `:inverse_of` with `:belongs_to` association. Commit where typo was introduced: https://github.com/rails/rails/commit/91fd6510563f84ee473bb217bc63ed598abe3f24#diff-39001423802a8470dba9c931e66e101eR11 First it appears in `activerecord/CHANGELOG` in example of `:inverse_of` usage: ```ruby class Post < ActiveRecord::Base has_many :taggings has_many :tags, :through => :taggings end class Tagging < ActiveRecord::Base belongs_to :post belongs_to :tag, :inverse_of => :tagging # :inverse_of must be set! end class Tag < ActiveRecord::Base has_many :taggings has_many :posts, :through => :taggings end post = Post.first tag = post.tags.build :name => "ruby" !> tag.save # will save a Taggable linking to the post ``` The last line should be ```ruby tag.save # will save a Tagging linking to the post ``` The same typo appears in `activerecord/lib/active_record/associations.rb`. The association name is given as `:inverse_of => :taggings`, but class name is `Taggable`. ```ruby # @post = Post.first # @tag = @post.tags.build :name => "ruby" # @tag.save # !> # The last line ought to save the through record (a <tt>Taggable</tt>). This will only work if the # <tt>:inverse_of</tt> is set: # !> # class Taggable < ActiveRecord::Base # belongs_to :post !> # belongs_to :tag, :inverse_of => :taggings # end ``` This PR fixes model name.
* | | | | | [ci skip] Fix #21364 error in documentation about ActiveRecord::EnumAndrew Grimm2015-08-251-2/+1
| | | | | |
* | | | | | Merge pull request #21354 from yui-knk/fix/migration_file_timestampRobin Dupret2015-08-241-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | [ci skip] Fix migration file's timestamp
| * | | | | | [ci skip] Fix migration file's timestampyui-knk2015-08-241-1/+1
| | |_|_|/ / | |/| | | | | | | | | | | | | | | | In rails generally migration file's timestamp is "YYYYMMDDHHMMSS".
* | | | | | Merge pull request #21342 from yui-knk/test/add_assert_methodRafael Mendonça França2015-08-241-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add `assert_nothing_raised` to make clear test case perpose
| * | | | | | Add `assert_nothing_raised` to make clear test case perposeyui-knk2015-08-231-1/+1
| | | | | | |
* | | | | | | Further fix failing tests caused by #21350Sean Griffin2015-08-241-0/+1
| | | | | | |
* | | | | | | Fix failing tests caused by #21350Sean Griffin2015-08-241-0/+1
| |_|_|/ / / |/| | | | |
* | | | | | Only nullify persisted has_one target associationsAgis-2015-08-246-1/+18
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since after 87d1aba3c `dependent: :destroy` callbacks on has_one assocations run *after* destroy, it is possible that a nullification is attempted on an already destroyed target: class Car < ActiveRecord::Base has_one :engine, dependent: :nullify end class Engine < ActiveRecord::Base belongs_to :car, dependent: :destroy end > car = Car.create! > engine = Engine.create!(car: car) > engine.destroy! # => ActiveRecord::ActiveRecordError: cannot update a > destroyed record In the above case, `engine.destroy!` deletes `engine` and *then* triggers the deletion of `car`, which in turn triggers a nullification of `engine.car_id`. However, `engine` is already destroyed at that point. Fixes #21223.
* | | | | Merge pull request #21341 from yui-knk/fix/ar_test_remove_innermethodYves Senn2015-08-231-5/+1
|\ \ \ \ \ | | | | | | | | | | | | Remove test helper method to inside test method
| * | | | | Remove test helper method to inside test methodyui-knk2015-08-231-5/+1
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | Remove `MigrationTest#connection` and write `ActiveRecord::Base.connection` directly to test, because `MigrationTest#connection` is only used in `test_migration_instance_has_connection`.
* | | | | Merge pull request #21332 from ronakjangir47/take_docsEileen M. Uchitelle2015-08-231-0/+25
|\ \ \ \ \ | |/ / / / |/| | | | Added docs for CollectionProxy#take
| * | | | Added docs for CollectionProxy#take [ci skip]Ronak Jangir2015-08-231-0/+25
| | |/ / | |/| |
* | | | Merge pull request #21335 from yui-knk/refactor/remove_not_used_block_argYves Senn2015-08-231-1/+1
|\ \ \ \ | |/ / / |/| | | Remove not used a block argument (`&block`)
| * | | Remove not used a block argument (`&block`)yui-knk2015-08-231-1/+1
| | |/ | |/|