aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
Commit message (Collapse)AuthorAgeFilesLines
* Fix regression on eager loading association based on SQL query ratherLauro Caetano2014-06-031-0/+12
| | | | | | than existing column. Fixes #15480.
* Revert "Merge pull request #14544 from jefflai2/named_scope_sti"Rafael Mendonça França2014-05-212-5/+0
| | | | | | | | | | | | This reverts commit 9a1abedcdeecd9464668695d4f9c1d55a2fd9332, reversing changes made to c72d6c91a7c0c2dc81cc857a1d6db496e84e0065. Conflicts: activerecord/CHANGELOG.md activerecord/test/models/comment.rb This change break integration with activerecord-deprecated_finders so I'm reverting until we find a way to make it work with this gem.
* build fix, use lambda syntax that ruby 1.9.3 understands.Yves Senn2014-05-211-1/+1
|
* Fix polymorphic eager load with foreign_key as String.Lauro Caetano2014-05-201-0/+3
| | | | | | | | | The foreign_key could be `String` and just doing `owners_map[owner_key]` could return `nil`. To prevent this bug, we should `to_s` both keys if their types are different. Fixes #14734.
* Merge pull request #14544 from jefflai2/named_scope_stiRafael Mendonça França2014-05-202-0/+5
|\ | | | | | | | | | | | | Fixes Issue #13466. Conflicts: activerecord/CHANGELOG.md
| * Fixes Issue #13466.Jefferson Lai2014-04-232-0/+5
| | | | | | | | | | | | Changed the call to a scope block to be evaluated with instance_eval. The result is that ScopeRegistry can use the actual class instead of base_class when caching scopes so queries made by classes with a common ancestor won't leak scopes.
* | test, inline `DeveloperWithAggregate`, which is used by a single test.Yves Senn2014-05-191-6/+0
| |
* | Merge pull request #14871 from kassio/kb-fixes-namespaced-habtmRafael Mendonça França2014-05-143-0/+8
|\ \ | | | | | | | | | | | | | | | | | | Fix how to compute class name on habtm namespaced. Conflicts: activerecord/CHANGELOG.md
| * | Fix how to compute class name on habtm namespaced.Kassio Borges2014-05-133-0/+8
| | | | | | | | | | | | | | | | | | Thank's for @laurocaetano for the help with tests. :smiley: Fixes #14709
* | | Merge pull request #15078 from nbudin/fix_merger_filter_binds_comparison_masterRafael Mendonça França2014-05-142-0/+17
|\ \ \ | |/ / |/| | | | | | | | | | | | | | Make filter_binds filter out symbols that are equal to strings Conflicts: activerecord/CHANGELOG.md
| * | Make filter_binds filter out symbols that are equal to stringsNat Budin2014-05-142-0/+17
|/ / | | | | | | | | | | | | | | | | | | | | | | | | ActiveRecord::Relation::Merger's filter_binds method does not filter out bind variables when one of the attribute nodes has a string name, but the other has a symbol name, even when those names are actually equal. This can result in there being more bind variables than placeholders in the generated SQL. This is particularly an issue for PostgreSQL, where this is treated as an error. This patch changes the filter_binds method to make it convert both attribute names to strings before comparing.
* | Fix broken proc syntax for 1.9.3Arthur Neves2014-05-091-1/+1
| |
* | test, regression test for has_many with instance dependent scope.Yves Senn2014-05-091-0/+2
| |
* | Fixed HABTM's CollectionAssociation sizeFred Wu2014-05-081-0/+2
| | | | | | | | | | HABTM should fall back to using the normal CollectionAssociation's size calculation if the collection is not cached or loaded. This addresses both #14913 and #14914 for master.
* | Add support for module-level table_suffix in modelsJenner LaFave2014-05-051-0/+18
| | | | | | | | | | This makes table_name_suffix work the same as table_name_prefix when using namespaced models. Pretty much the same as 67d1cec.
* | Merge pull request #14978 from bogdan/relation-joinRafael Mendonça França2014-05-051-0/+4
|\ \ | | | | | | | | | [Regression 4.0 -> 4.1] Put back Relation#join method as a delegate to Array
| * | Put back Relation#join method as a delegate to ArrayBogdan Gusiev2014-05-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | This is a regression 4.0 -> 4.1 fix. In 4.1.0 Relation#join is delegated to Arel#SelectManager. In 4.0 series it is delegated to Array#join This patch puts back the behaviour of 4.0
* | | Get rid of unused method in AR Post test modelCarlos Antonio da Silva2014-05-051-4/+0
|/ /
* | Fixed custom validation context bug where childEric Chahin2014-05-012-0/+12
| | | | | | | | | | | | | | | | associations were not being saved. Fixes #13854. [Eric Chahin, Aaron Nelson, & Kevin Casey]
* | Merge branch 'master' into adequaterecordAaron Patterson2014-04-252-0/+6
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (28 commits) move AR length validation tests into separate test-case. No need for trailing slash on migration path. reset `@arel` when modifying a Relation in place. PostgreSQL Timestamps always map to `:datetime`. [ci skip] Improve formatting and yml Fix a typo in the doc of forty_two AR FinderMethod Improve readability of contributing to rails guide. [ci skip] Precompile the image we're referencing, too. `ActiveRecord::Base.no_touching` no longer triggers callbacks or start empty transactions. Fixed an issue with migrating legacy json cookies. Correct comment [ci skip] Perfer to define methods instead of calling test Fix syntax error Add CHANGELOG entry for #14757 [ci skip] Fix run-on sentences and improve grammar [skip ci] Add test for using ActionView::Helpers::FormHelper.label with block and html select! renamed to avoid name collision Array#select! Rearrange deck chairs on the titanic. Organize connection handling test cases. Change favicon_link_tag helper mimetype from image/vnd.microsoft.icon to image/x-icon. ActionController::Renderers documentation fix ...
| * \ Merge pull request #14573 from habermann24/has_many_through_fixRafael Mendonça França2014-04-222-0/+6
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Properly handle scoping with has_many :through. Fixes #14537. Conflicts: activerecord/CHANGELOG.md activerecord/test/cases/associations/has_many_through_associations_test.rb
| | * | Properly handle scoping with has_many :through. Fixes #14537.Jan Habermann2014-04-032-0/+6
| | | |
* | | | Merge branch 'master' into adequaterecordAaron Patterson2014-04-201-1/+0
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (74 commits) [ci skip] builtin -> built-in Fix code indentation and improve formatting Grammar fix in Getting Started Guide Make URL escaping more consistent Optimize URI escaping Always escape string passed to url helper. Remove statement assuming coffee shop/public space wifi is inherently insecure Don't rely on Arel master in bug report template [ci skip] wrap methods in backticks [ci skip] "subhash" --> "sub-hash" multibyte_conformance.rb --> multibyte_conformance_test.rb Fix inconsistent behavior from String#first/#last `@destroyed` should always be set to `false` when an object is duped. remove warning `warning: ambiguous first argument; put parentheses or even spaces` :uglify -> :uglifier Regression test for irregular inflection on has_many Singularize association names before camelization Fix spelling and proper nouns Optimize select_value, select_values, select_rows and dry up checking whether to exec with cache for Postgresql adapter Include default rails protect_from_forgery with: :exception ... Conflicts: activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
| * | | Remove outdated commentRafael Mendonça França2014-04-141-1/+0
| | | |
* | | | Merge branch 'master' into adequaterecordAaron Patterson2014-04-143-0/+8
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (70 commits) [ci skip] Added link to ruby-lang.org installation. Use the index on hidden field `collection_check_boxes` respects `:index` option for the hidden filed name. docs, double meaning of `serialize` argument. Closes #14284. Just call read_attribute, no need to use `send`. - Fix lingering reference to `:text` instead of the newer `:plain` - Section references `form_tag` instead of the `form_for` used in the example again, read_attribute is public, so just call it read_attribute is public, so we should just call it Disable assest cache store in docs [ci skip] Make counter cache decrementation on destroy idempotent Write the failing test case for concurrent counter cache [ci skip] Use plain underscore instead of "\_". Update documentation to use Rails.application instead Add a changelog entry for #14546 [ci skip] Move tests for deep_dup and duplicable to object directory Missing 'are' in note - [ci skip] CollectionHelpers now accepts a readonly option Fix a few typos [ci skip] Bundle tzinfo-data on :x64_mingw (64-bit Ruby on Windows). don't bother with an offset if the offset is zero ...
| * | | Merge pull request #12829 from iantropov/issue_insert_via_hmt_scope_3548Rafael Mendonça França2014-04-101-0/+2
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix insertion of records for hmt association with scope Conflicts: activerecord/CHANGELOG.md
| | * | | Fix insertion of records for hmt association with scope, fix #3548Ivan Antropov2013-11-171-0/+2
| | | | |
| * | | | Merge branch 'master' into rm-uuid-fixturesRafael Mendonça França2014-04-104-2/+11
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG.md activesupport/CHANGELOG.md
| * \ \ \ \ Merge pull request #12016 from roderickvd/uuid_fixesRafael Mendonça França2014-04-042-0/+6
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Auto-generate stable fixture UUIDs on PostgreSQL Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/fixtures.rb activerecord/test/cases/adapters/postgresql/uuid_test.rb activesupport/CHANGELOG.md
| | * | | | | Auto-generate stable fixture UUIDs on PostgreSQL.Roderick van Domburg2014-01-072-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes: #11524
* | | | | | | propogate bind values collected in arel to SQL generationAaron Patterson2014-04-111-0/+2
| |_|/ / / / |/| | | | |
* | | | | | The `source` option for `has_many => through` should accept StringLauro Caetano2014-04-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | values. With the changes introduced by 16b70fddd4dc7e7fb7be108add88bae6e3c2509b it was expecting the value to be a Symbol, while it could be also a String value.
* | | | | | Fix the test defining the models in the right placeRafael Mendonça França2014-04-042-0/+5
| | | | | |
* | | | | | Merge pull request #14562 from jefflai2/collection_proxyRafael Mendonça França2014-04-041-0/+4
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | CollectionProxy uses the arel of its association's scope. Conflicts: activerecord/CHANGELOG.md
| * | | | | CollectionProxy uses the arel of its association's scope.Jefferson Lai2014-04-021-0/+4
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | CollectionProxy should be able to reuse the behavior (methods) of its parent class, but with its own state. This change allows CollectionProxy to use the arel object corresponding to its association's scope.
* / | | | Fix error when using `with_options` with lambda.Lauro Caetano2014-04-032-0/+6
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was causing error when using `with_options` passing a lambda as its last argument. class User < ActiveRecord::Base with_options dependent: :destroy do |assoc| assoc.has_many :profiles, -> { where(active: true) } end end It was happening because the `option_merger` was taking the last argument and checking if it was a Hash. This breaks the HasMany usage, because its last argument can be a Hash or a Proc. As the behavior described in this test: https://github.com/rails/rails/blob/master/activesupport/test/option_merger_test.rb#L69 the method will only accept the lambda, this way it will keep the expected behavior. See 9eaa0a34
* | | | Merge pull request #14154 from al2o3cr/issue12770Aaron Patterson2014-03-271-0/+1
|\ \ \ \ | | | | | | | | | | Pass a base relation to build_default_scope when joining
| * | | | Pass a base relation to build_default_scope when joiningMatt Jones2014-02-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This allows the default scope to be built using the current table alias. Resolves #12770
* | | | | AR .persisted? throws SystemStackError for an unsaved model with achrisfinne2014-03-271-0/+2
| |_|_|/ |/| | | | | | | | | | | custom primary_key that didn't save due to validation error
* | | | Obey `validate: false` option for habtmCarlos Antonio da Silva2014-03-142-0/+14
| | | | | | | | | | | | | | | | Fixes #14383.
* | | | Add tests for default scope behaviour changeJon Leighton2014-02-231-0/+2
|/ / / | | | | | | | | | See #13875
* | | Revert "context in validation goes through has many relationship"Aaron Patterson2014-02-202-16/+0
| | | | | | | | | | | | This reverts commit 5e3d466d52fa4e9a42c3a1f8773a7c31da875e48.
* | | Merge pull request #13978 from Fortisque/kevin/validation_context_for_childrenAaron Patterson2014-02-082-0/+16
|\ \ \ | | | | | | | | context in validation goes through has many relationship
| * | | context in validation goes through has many relationshipKevin Casey2014-02-082-0/+16
| | | |
* | | | Add test case for autosave HasMany with accepts_nested_attributes.Lauro Caetano2014-02-082-0/+4
|/ / / | | | | | | | | | | | | | | | | | | It should not save the parent record when the nested attributes are invalid. Test case to cover #8194.
* | | docs, AR already auto-detects primary keys. Closes #13946. [ci skip]Yves Senn2014-02-051-2/+0
| | | | | | | | | | | | | | | This behavior was introduced since Rails 3.1 (207f266ccaaa9cd04cd2a7513ae5598c4358b510) but the docs were still out of date.
* | | pass `habtm :autosave` to underlying `hm:t` association. Closes #13923.Yves Senn2014-02-031-0/+1
| | |
* | | Add more tests for the dirty feature for enumsRafael Mendonça França2014-01-211-0/+1
| | |
* | | Make AR::Base#touch fire the after_commit and after_rollback callbacksHarry Brundage2014-01-162-1/+17
| | |
* | | Don't try to get the subclass if the inheritance column doesn't existUjjwal Thaakar2014-01-141-0/+5
|/ / | | | | | | | | | | | | The `subclass_from_attrs` method is called even if the column specified by the `inheritance_column` setting doesn't exist. This prevents setting associations via the attributes hash if the association name clashes with the value of the setting, typically `:type`. This worked previously in Rails 3.2.