aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
Commit message (Collapse)AuthorAgeFilesLines
...
* Unused test modelAkira Matsuda2013-01-241-5/+0
|
* Goodbye there, very special rubbish!Akira Matsuda2013-01-244-19/+1
|
* proxy_{owner,reflection,target} are no more availableAkira Matsuda2013-01-241-11/+1
|
* Unused model DeprecatedPostWithCommentAkira Matsuda2013-01-241-7/+0
|
* Remove warning by using a custom coderAndrew White2013-01-231-2/+16
| | | | | | | | | | | | | | The native JSON library bypasses the `to_json` overrides in active_support/core_ext/object/to_json.rb by calling its native implementation directly. However `ActiveRecord::Store` uses a HWIA so `JSON.dump` will call our `to_json` instead with a `State` object for options rather than a `Hash`. This generates a warning when the `:encoding`, `:only` & `:except` keys are accessed in `Hash#as_json` because the `State` object delegates unknown keys to `instance_variable_get` in its `:[]` method. Workaround this warning in the test by using a custom coder that calls `ActiveSupport::JSON.encode` directly.
* Merge pull request #8913 from ↵Carlos Antonio da Silva2013-01-201-0/+3
|\ | | | | | | | | seejee/regression_test_for_chained_preloaded_scopes Added test case to prevent regression of chained, preloaded scopes.
| * Added test case to prevent regression of chained, preloaded scopes. (#7490)Chris Geihsler2013-01-191-0/+3
| |
* | Merge pull request #8994 from Springest/fix_default_scope_update_all_delete_allJon Leighton2013-01-181-0/+9
|\ \ | | | | | | Fix .update_all and .delete_all when using a condition on a joined table in a default_scope
| * | Fix .update_all and .delete_all when using a condition on a joined tableDerek Kraan2013-01-111-0/+9
| |/ | | | | | | | | | | | | | | | | in a default_scope. `Model.joins(...).where(condition_on_joined_table).update_all` / `delete_all` worked, but the same operation implemented with a default_scope generated a SQL error because ActiveRecord ignored the join but implemented the where condition anyways.
* / Undeprecate the :extend optionJon Leighton2013-01-181-0/+14
|/ | | | | | | Suggested by @dhh. It doesn't affect the generated SQL, so seems reasonable to continue to allow it as an association option.
* Rename update_attributes method to update, keep update_attributes as an aliasAmparo Luna + Guillermo Iguaran2013-01-031-1/+1
|
* unused scopeAkira Matsuda2013-01-021-2/+0
|
* Fix broken test for postgresqlRafael Mendonça França2012-12-211-1/+1
| | | | | | For some reason postgresql doesn't pass an integer value to load. cc @tenderlove
* Serialized attribute can be serialized in an integer columnRafael Mendonça França2012-12-211-0/+21
| | | | Fix #8575
* Allow users to choose the timestamp format in the cache keyRafael Mendonça França2012-12-101-0/+5
| | | | | | | This can be done using the class attribute cache_timestamp_format Conflicts: railties/guides/source/configuring.textile
* Make sure the tests pass in the case closer to described in #8195Rafael Mendonça França2012-12-101-1/+1
| | | | | | Conflicts: activerecord/test/models/bulb.rb activerecord/test/schema/schema.rb
* Do not instantiate intermediate AR objects when eager loading.Yves Senn2012-12-041-0/+10
| | | | Closes #3313
* Added STI support to init and building associationsJason Rush2012-11-292-0/+2
| | | | | | | | Allows you to do BaseClass.new(:type => "SubClass") as well as parent.children.build(:type => "SubClass") or parent.build_child to initialize an STI subclass. Ensures that the class name is a valid class and that it is in the ancestors of the super class that the association is expecting.
* Initialize accessors to remove some warnings in Ruby 2.0Carlos Antonio da Silva2012-11-191-3/+2
|
* Regression test for #7238Nikita Afanasenko2012-11-131-0/+6
|
* :counter_cache option for to support custom named counter caches. Closes #7993Yves Senn2012-11-041-0/+1
|
* Remove ActiveRecord::ModelJon Leighton2012-10-261-35/+0
| | | | | | | | | | In the end I think the pain of implementing this seamlessly was not worth the gain provided. The intention was that it would allow plain ruby objects that might not live in your main application to be subclassed and have persistence mixed in. But I've decided that the benefit of doing that is not worth the amount of complexity that the implementation introduced.
* fix warning: method redefinedkennyj2012-10-021-1/+1
|
* Fix reset_counters() crashing on has_many :through associations.lulalala2012-10-021-1/+1
| | | | | The counter column name in the intermediate model need to be access via the through reflection.
* Revert "Fix find_in_batches with customized primary_key"Santiago Pastorino2012-09-211-5/+0
| | | | | | | This reverts commit 761bc751d31c22e2c2fdae2b4cdd435b68b6d783. This commit wasn't fixing any issue just using the same table for different models with different primary keys.
* Remove mass_assignment_options from ActiveRecordGuillermo Iguaran2012-09-161-3/+3
|
* Remove mass assignment security from ActiveRecordGuillermo Iguaran2012-09-166-20/+0
|
* Fix find_in_batches with customized primary_keyToshiyuki Kawanishi2012-09-161-0/+5
|
* refactor store_accessorMatt Jones2012-09-131-1/+9
|
* Fix nested association referencesJon Leighton2012-09-121-0/+1
| | | | | Previously the reflection would be looked up on the wrong class. However the test passed because the examples referred back to themselves.
* Accept belongs_to assoc. keys in ActiveRecord queriesbeerlington2012-09-111-0/+3
| | | | | | | | | | | | | Allows you to specify the model association key in a belongs_to relationship instead of the foreign key. The following queries are now equivalent: Post.where(:author_id => Author.first) Post.where(:author => Author.first) PriceEstimate.where(:estimate_of_type => 'Treasure', :estimate_of_id => treasure) PriceEstimate.where(:estimate_of => treasure)
* Merge pull request #7532 from al2o3cr/fix_store_bugsRafael Mendonça França2012-09-051-0/+1
|\ | | | | correct handling of changes in AR::Store, combine multiple store_accessors
| * correctly flag changed attributes in AR::Store, combine multiple calls to ↵Matt Jones2012-09-051-0/+1
| | | | | | | | store_accessor
* | Fix pluck when columns/tables are reserved words.Ian Lesperance2012-09-051-0/+3
|/
* test cleanup, remove ruby_type because it's no longer neededYves Senn2012-09-031-4/+0
| | | | | All tests with a custom inheritance_column use the `Vegtable` model. The field ruby_type on the Company models is no longer needed
* rewrite inheritance tests with a custom inheritance_columnYves Senn2012-09-031-0/+10
| | | | | | previously the tests with and without a custom `inheritance_column` used the same models. Since the model then has both fields this can lead to false positives.
* set the configured #inheritance_column on #become (#7503)Yves Senn2012-09-031-0/+14
| | | | | | | | | | | | | | | I had to create a new table because I needed an STI table, which does not have both a "type" and a "custom_type" the test fails with: 1) Error: test_alt_becomes_works_with_sti(InheritanceTest): NoMethodError: undefined method `type=' for #<Cabbage id: 1, name: "my cucumber", custom_type: "Cucumber"> /Users/username/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:432:in `method_missing' /Users/username/Projects/rails/activerecord/lib/active_record/attribute_methods.rb:100:in `method_missing' /Users/username/Projects/rails/activerecord/lib/active_record/persistence.rb:165:in `becomes' test/cases/inheritance_test.rb:134:in `test_becomes_works_with_sti' test/cases/inheritance_test.rb:140:in `test_alt_becomes_works_with_sti'
* Add a test to make sure preloading properly merges association and default ↵Pratik Naik2012-08-282-0/+11
| | | | scope conditions
* allow to pass Symbol or Proc into :limit option of ↵Mikhail Dieterle2012-08-261-1/+1
| | | | #accepts_nested_attributes_for
* reset_counters() was crashing when there were multiple belongs_to ↵Dave Desrochers2012-08-212-0/+6
| | | | | | associations with the same foreign key. This closes #5200.
* Use method compilation for association methodsJon Leighton2012-08-102-4/+3
| | | | | | | | | Method compilation provides better performance and I think the code comes out cleaner as well. A knock on effect is that methods that get redefined produce warnings. I think this is a good thing. I had to deal with a bunch of warnings coming from our tests, though.
* Remove the dependent_restrict_raises option.Jon Leighton2012-08-101-2/+14
| | | | | | | | | | | | | | | It's not really a good idea to have this as a global config option. We should allow people to specify the behaviour per association. There will now be two new values: * :dependent => :restrict_with_exception implements the current behaviour of :restrict. :restrict itself is deprecated in favour of :restrict_with_exception. * :dependent => :restrict_with_error implements the new behaviour - it adds an error to the owner if there are dependent records present See #4727 for the original discussion of this.
* Deprecate :finder_sql, :counter_sql, :insert_sql, :delete_sql.Jon Leighton2012-08-013-26/+36
|
* Revert "Remove :finder_sql, :counter_sql, :insert_sql, :delete_sql."Jon Leighton2012-08-013-1/+24
| | | | | | | | | This reverts commit 3803fcce26b837c0117f7d278b83c366dc4ed370. Conflicts: activerecord/CHANGELOG.md It will be deprecated only in 4.0, and removed properly in 4.1.
* Revert "Removing composed_of from ActiveRecord."Rafael Mendonça França2012-07-272-0/+13
| | | | | | | | | | | This reverts commit 14fc8b34521f8354a17e50cd11fa3f809e423592. Reason: we need to discuss a better path from this removal. Conflicts: activerecord/lib/active_record/reflection.rb activerecord/test/cases/base_test.rb activerecord/test/models/developer.rb
* Deprecate ActiveRecord::Base.scoped.Jon Leighton2012-07-276-15/+16
| | | | | | | It doesn't serve much purpose now that ActiveRecord::Base.all returns a Relation. The code is moved to active_record_deprecated_finders.
* rm unnecessary testJon Leighton2012-07-202-5/+0
| | | | | interpolation is no longer a thing separate from "normal" assoc conditions.
* rm redundant testJon Leighton2012-07-201-2/+0
| | | | now everything is converted to the new style, this is not needed
* Remove :finder_sql, :counter_sql, :insert_sql, :delete_sql.Jon Leighton2012-07-203-24/+1
|
* Convert association macros to the new syntaxJon Leighton2012-07-2015-134/+135
|