aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | 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
| | |/ / | |/| |
* / | | JSON is still an adapter specific type.Sean Griffin2015-08-218-36/+50
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several changes were made in #21110 which I am strongly opposed to. (this is what I get for going on vacation. :trollface:) No type should be introduced into the generic `ActiveRecord::Type` namespace, and *certainly* should not be registered into the registry unconstrained unless it is supported by *all* adapters (which basically means that it was specified in the ANSI SQL standard). I do not think `# :nodoc:` ing the type is sufficient, as it still makes the code of Rails itself very unclear as to what the role of that class is. While I would argue that this shouldn't even be a super class, and that MySql and PG's JSON types are only superficially duplicated (they might look the same but will change for different reasons in the future). However, I don't feel strongly enough about it as a point of contention (and the biggest cost of harming the blameability has already occured), so I simply moved the superclass into a namespace where its role is absolutely clear. After this change, `attribute :foo, :json` will once again work with MySQL and PG, but not with Sqlite3 or any third party adapters. Unresolved questions -------------------- The types that and adapter publishes (at least those are unique to that adapter, and not adding additional behavior like `MysqlString` should probably be part of the adapter's public API. Should we standardize the namespace for these, and document them?
* | | better docs for `disable_ddl_transaction!`. Closes #21044.Yves Senn2015-08-211-1/+4
| | |
* | | Fix Punctuation in `AutosaveAssociation` RDocRobert Eshleman2015-08-201-2/+2
| | | | | | | | | | | | [ci skip]
* | | uniqueness validation raises error for persisted record without pk.Yves Senn2015-08-204-4/+39
| | | | | | | | | | | | | | | | | | | | | | | | Closes #21304. While we can validate uniqueness for record without primary key on creation, there is no way to exclude the current record when updating. (The update itself will need a primary key to work correctly).
* | | Merge pull request #21282 from sjain1107/added_docsYves Senn2015-08-191-0/+3
|\ \ \ | | | | | | | | | | | | Added docs for TableDefinition #coloumns & #remove_column [ci skip]
| * | | Added docs for TableDefinition #coloumns & #remove_column [ci skip]sjain11072015-08-181-0/+3
| | | |
* | | | Add a native JSON data type support in MySQLRyuta Kamizono2015-08-1811-50/+258
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of MySQL 5.7.8, MySQL supports a native JSON data type. Example: create_table :json_data_type do |t| t.json :settings end
* | | | Merge pull request #21283 from ravindrakumawat/add_docs_for_pending_migrationYves Senn2015-08-181-0/+1
|\ \ \ \ | | | | | | | | | | Add Docs for ActiveRecord #check_pending [ci skip]
| * | | | Add Docs for ActiveRecord #check_pending [ci skip]ravindra kumar kumawat2015-08-181-0/+1
| | | | |
* | | | | Merge pull request #21284 from prakashlaxkar/argument_error_testsYves Senn2015-08-182-1/+9
|\ \ \ \ \ | |_|/ / / |/| | | | | | | | | Correct error message in Standard American english and add a test cas…
| * | | | Correct error message in Standard American english and add a test case for ↵prakash2015-08-182-1/+14
|/ / / / | | | | | | | | | | | | the same.
* | | | Fix middleware deprecation message. Related to #21172.Jon Atack2015-08-141-1/+1
| | | |
* | | | Merge pull request #19683 from tristang/require-option-for-counter-cacheRafael Mendonça França2015-08-137-6/+56
|\ \ \ \ | | | | | | | | | | | | | | | Require explicit counter_cache option for has_many
| * | | | Add tests for associations without counter_cacheTristan Gamilis2015-04-094-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | Assert that counter_cache behaviour is not used on belongs_to or has_many associations if the option is not given explicitly.
| * | | | Require explicit counter_cache option for has_manyTristan Gamilis2015-04-073-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously has_many associations assumed a counter_cache was to be used based on the presence of an appropriately named column. This is inconsistent, since the inverse belongs_to association will not make this assumption. See issues #19042 #8446. This commit checks for the presence of the counter_cache key in the options of either the has_many or belongs_to association as well as ensuring that the *_count column is present.
* | | | | Merge pull request #19770 from vngrs/prevent_duplicated_where_clausesRafael Mendonça França2015-08-133-0/+14
|\ \ \ \ \ | | | | | | | | | | | | Prevent duplicating `where` clauses
| * | | | | Prevent duplicating `where` clauses when model is extended from an abstract ↵Mehmet Emin İNAÇ2015-04-153-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | class Fixes #19528 fix for mysql2 test better test
* | | | | | descriptive error message when fixtures contian a missing column.Yves Senn2015-08-134-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | Closes #21201.
* | | | | | use `assert_not` instead of `refute` as mentioned in our guides.Yves Senn2015-08-136-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As described in the "Follow Coding Conventions" section in our contribution guide (http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions) we favor `assert_not` over `refute`. While we don't usually make stylistic changes on it's own I opted to do it in this case. The reason being that test cases are usually copied as a starting point for new tests. This results in a spread of `refute` in files that have been using it already.
* | | | | | Skip statement cache on through association readerRafael Mendonça França2015-08-1211-21/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the through class has default scopes we should skip the statement cache. Closes #20745.
* | | | | | Merge pull request #21210 from akihiro17/fix-rdoc-markupRafael Mendonça França2015-08-121-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | [ci skip] Fix rdoc markup
| * | | | | | [ci skip] Fix rdoc markupakihiro172015-08-121-1/+1
| | | | | | |
* | | | | | | docs, tiny rdoc markup fix. [ci skip]Yves Senn2015-08-121-1/+2
|/ / / / / / | | | | | | | | | | | | | | | | | | `+` doesn't work around content with spaces fallback `<tt>`.
* | | | | | Merge pull request #21205 from akihiro17/fix-docMatthew Draper2015-08-121-13/+13
|\ \ \ \ \ \ | | | | | | | | | | | | | | [ci skip] Fix the indentation
| * | | | | | [ci skip] Fix the indentationakihiro172015-08-121-13/+13
| | | | | | |
* | | | | | | Merge pull request #17885 from starbelly/patch-1Yves Senn2015-08-113-14/+31
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add method to run command-line db apps Conflicts: activerecord/CHANGELOG.md
| * | | | | | | Add run_cmd class method to ActiveRecord::Tasks::DatabaseTasksstarbelly2015-08-014-17/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added run_cmd() class method to dry up Kernel.system() messages within this namespace and avoid shell expansion by passing a list of arguments instead of a string - Update structure_dump, structure_load, and related tests units to pass a list of params instead of using a string to avoid shell expansion
* | | | | | | | Merge pull request #21165 from manlon/masterRafael Mendonça França2015-08-115-3/+34
|\ \ \ \ \ \ \ \ | |_|/ / / / / / |/| | | | | | | use correct DB connection for generated HABTM table
| * | | | | | | use correct DB connection for generated HABTM tableMatt Hanlon2015-08-075-3/+34
| | | | | | | |
* | | | | | | | Reference actual classesMiles Starkenburg2015-08-081-5/+5
| | | | | | | |