- 22 9月, 2012 1 次提交
-
-
由 Santiago Pastorino 提交于
This reverts commit 761bc751. This commit wasn't fixing any issue just using the same table for different models with different primary keys.
-
- 17 9月, 2012 2 次提交
-
-
由 Guillermo Iguaran 提交于
-
由 Guillermo Iguaran 提交于
-
- 16 9月, 2012 1 次提交
-
-
由 Toshiyuki Kawanishi 提交于
-
- 13 9月, 2012 2 次提交
-
-
由 Matt Jones 提交于
-
由 Jon Leighton 提交于
Previously the reflection would be looked up on the wrong class. However the test passed because the examples referred back to themselves.
-
- 12 9月, 2012 1 次提交
-
-
由 beerlington 提交于
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)
-
- 06 9月, 2012 1 次提交
-
-
由 Ian Lesperance 提交于
-
- 05 9月, 2012 1 次提交
-
-
由 Matt Jones 提交于
-
- 04 9月, 2012 2 次提交
-
-
由 Yves Senn 提交于
All tests with a custom inheritance_column use the `Vegtable` model. The field ruby_type on the Company models is no longer needed
-
由 Yves Senn 提交于
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.
-
- 03 9月, 2012 1 次提交
-
-
由 Yves Senn 提交于
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'
-
- 29 8月, 2012 1 次提交
-
-
由 Pratik Naik 提交于
-
- 26 8月, 2012 1 次提交
-
-
由 Mikhail Dieterle 提交于
-
- 22 8月, 2012 1 次提交
-
-
由 Dave Desrochers 提交于
reset_counters() was crashing when there were multiple belongs_to associations with the same foreign key. This closes #5200.
-
- 11 8月, 2012 2 次提交
-
-
由 Jon Leighton 提交于
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.
-
由 Jon Leighton 提交于
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.
-
- 02 8月, 2012 2 次提交
-
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
This reverts commit 3803fcce. Conflicts: activerecord/CHANGELOG.md It will be deprecated only in 4.0, and removed properly in 4.1.
-
- 28 7月, 2012 2 次提交
-
-
由 Rafael Mendonça França 提交于
This reverts commit 14fc8b34. 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
-
由 Jon Leighton 提交于
It doesn't serve much purpose now that ActiveRecord::Base.all returns a Relation. The code is moved to active_record_deprecated_finders.
-
- 21 7月, 2012 3 次提交
-
-
由 Jon Leighton 提交于
interpolation is no longer a thing separate from "normal" assoc conditions.
-
由 Jon Leighton 提交于
now everything is converted to the new style, this is not needed
-
由 Jon Leighton 提交于
-
- 20 7月, 2012 1 次提交
-
-
由 Jon Leighton 提交于
-
- 13 7月, 2012 1 次提交
-
-
由 Jon Leighton 提交于
-
- 28 6月, 2012 1 次提交
-
-
由 Carlos Antonio da Silva 提交于
Since composed_of was removed in 05174744, these tests were working "by mistake", due to the matching "address" string in the error message, but with a different error message than the expected multiparameter assignment error. Since "address" is not an attribute from Customer anymore, the error was "undefined method klass for nil", where nil was supposed to be the column object.
-
- 22 6月, 2012 3 次提交
-
-
由 Maximilian Schneider 提交于
previously dynamic finders only worked in combination with the actual column name and not its alias defined with #alias_attribute
-
由 Carlos Antonio da Silva 提交于
ActiveRecord json/xml serialization should use as base serializable_hash, provided by ActiveModel. Add some more coverage around options :only and :except for both json and xml serialization.
-
由 Andrew White 提交于
Improve the derivation of HABTM join table name to take account of nesting. It now takes the table names of the two models, sorts them lexically and then joins them, stripping any common prefix from the second table name. Some examples: Top level models (Category <=> Product) Old: categories_products New: categories_products Top level models with a global table_name_prefix (Category <=> Product) Old: site_categories_products New: site_categories_products Nested models in a module without a table_name_prefix method (Admin::Category <=> Admin::Product) Old: categories_products New: categories_products Nested models in a module with a table_name_prefix method (Admin::Category <=> Admin::Product) Old: categories_products New: admin_categories_products Nested models in a parent model (Catalog::Category <=> Catalog::Product) Old: categories_products New: catalog_categories_products Nested models in different parent models (Catalog::Category <=> Content::Page) Old: categories_pages New: catalog_categories_content_pages Also as part of this commit the validity checks for HABTM assocations have been moved to ActiveRecord::Reflection One side effect of this is to move when the exceptions are raised from the point of declaration to when the association is built. This is consistant with other association validity checks.
-
- 19 6月, 2012 1 次提交
-
-
由 Steve Klabnik 提交于
This feature adds a lot of complication to ActiveRecord for dubious value. Let's talk about what it does currently: class Customer < ActiveRecord::Base composed_of :balance, :class_name => "Money", :mapping => %w(balance amount) end Instead, you can do something like this: def balance @balance ||= Money.new(value, currency) end def balance=(balance) self[:value] = balance.value self[:currency] = balance.currency @balance = balance end Since that's fairly easy code to write, and doesn't need anything extra from the framework, if you use composed_of today, you'll have to add accessors/mutators like that. Closes #1436 Closes #2084 Closes #3807
-
- 10 6月, 2012 1 次提交
-
-
由 Andrew White 提交于
There are two possible scenarios where the @mass_assignment_options instance variable can become corrupted: 1. If the assign_attributes doesn't complete correctly, then subsequent calls to a nested attribute assignment method will use whatever options were passed to the previous assign_attributes call. 2. With nested assign_attributes calls, the inner call will overwrite the current options. This will only affect nested attributes as the attribute hash is sanitized before any methods are called. To fix this we save the current options in a local variable and then restore these options in an ensure block.
-
- 24 5月, 2012 1 次提交
-
- 22 5月, 2012 1 次提交
-
-
由 Carlos Antonio da Silva 提交于
Only constantize class_name once.
-
- 20 5月, 2012 1 次提交
-
-
由 Henrik Hodne 提交于
For future reference, this is the regex I used: ^\s*#\s*\n(?!\s*#). Replace with the first match, and voilà! Note that the regex matches a little bit too much, so you probably want to `git add -i .` and go through every single diff to check if it actually should be changed.
-
- 09 5月, 2012 1 次提交
-
-
由 Andrey Voronkov 提交于
-
- 03 5月, 2012 2 次提交
-
-
由 Yves Senn 提交于
This makes it possible to filter invalid input values before they are passed into the value-object (like empty strings). This behaviour is only relevant if the :allow_nil options is set to true. Otherwise you will get the resulting NoMethodError.
-
由 Carlos Antonio da Silva 提交于
Change CollectionProxy#method_missing to use scoped.public_send, to avoid a problem described in issue #2508 when trying to use class methods with names like "open", that clash with private kernel methods. Also changed the dynamic matcher instantiator to send straight to scoped, to avoid another roundtrip to method_missing.
-
- 27 4月, 2012 2 次提交
-
-
由 Jon Leighton 提交于
-
由 Jon Leighton 提交于
-