aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/core.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* Minor refactor in ActiveRecord#initialize_dupCarlos Antonio da Silva2012-09-071-10/+4
| | | | | | * There is no need to delete the primary key from cloned attributes, since it sets the same pk to nil afterwards. * Check for empty? instead of any? to run initialize callbacks.
* create a transaction object and point AR objects at that object during aAaron Patterson2012-09-071-0/+1
| | | | transaction.
* initialize instance variables for transactions to remove conditionalsAaron Patterson2012-08-201-0/+1
|
* Avoid #any?Jon Leighton2012-08-171-1/+1
| | | | | | any? will check that each item in the array is truthy, as opposed to !empty? which will simply check that the array has length. For an empty array, !empty? still seems to be faster than any?
* Avoid deep_dup when intantiating.Jon Leighton2012-08-171-2/+5
| | | | | deep_dup is slow. we only need to dup the values, so just do that directly.
* Remove the dependent_restrict_raises option.Jon Leighton2012-08-101-9/+0
| | | | | | | | | | | | | | | 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.
* load active_support/core_ext/module/delegation in active_support/railsXavier Noria2012-08-021-1/+0
|
* load active_support/concern in active_support/railsXavier Noria2012-08-021-1/+0
|
* Revert "Removing composed_of from ActiveRecord."Rafael Mendonça França2012-07-271-0/+2
| | | | | | | | | | | 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
* Fix activerecord model to_ary method comment 'see also' linkKang Wen2012-07-161-1/+1
|
* Removing composed_of from ActiveRecord.Steve Klabnik2012-06-181-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Simplify AR configuration code.Jon Leighton2012-06-151-63/+74
| | | | | Get rid of ActiveModel::Configuration, make better use of ActiveSupport::Concern + class_attribute, etc.
* Ensure that mass assignment options are preservedAndrew White2012-06-101-9/+10
| | | | | | | | | | | | | | | | 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.
* Fix #5797. Error calling dup method on AR model with serialized fieldkennyj2012-05-301-1/+1
|
* remove unnecessary ruby 1.8 reference from active_record/core [ci skip]Francesco Rodriguez2012-05-261-3/+4
|
* Fix typo.Peter Suschlik2012-05-181-1/+1
|
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-05-171-1/+1
|\ | | | | | | | | Conflicts: activerecord/lib/active_record/core.rb
| * Fix typos in docs for ActiveRecord::Core::arel_table [ci skip]Mark Rushakoff2012-05-161-3/+1
| |
| * Fix typo [ci skip]Peter Suschlik2012-05-151-1/+1
| |
* | Remove extra `end` in arel_table docs. [ci skip]Carlos Antonio da Silva2012-05-151-8/+6
|/ | | | Introduced in 7ecfe3d30ccfaee8dcca4ee649cc006c090bdfb4
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-05-151-0/+8
|\ | | | | | | | | Conflicts: actionpack/lib/action_view/helpers/asset_tag_helper.rb
| * Add documentation for arel_tableOscar Del Ben2012-05-141-0/+8
| |
* | fixes a nodoc which swallowed the documentation for the rest of the methods ↵Vijay Dev2012-05-121-2/+1
|/ | | | [ci skip]
* Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-05-121-1/+23
|\ | | | | | | | | Conflicts: activesupport/lib/active_support/callbacks.rb
| * copy edits [ci skip]Vijay Dev2012-05-121-4/+1
| |
| * Better document the difference between #clone and #dup.Erich Menge2012-05-111-1/+26
| | | | | | | | | | Add #nodoc to initialize_dup and use :method: to document the #dup method. Relates to issue #6235
* | s/wether/whether [ci skip]Vijay Dev2012-05-121-1/+1
|/
* Use deep_dup in aciverecord default columns assignmentPiotr Sarnacki2012-05-061-4/+2
|
* Duplicate column_defaults properly (closes #6115)Piotr Sarnacki2012-05-041-1/+4
|
* Removes caching from ActiveRecord::Core::ClassMethods#relationBenedikt Deicke2012-04-031-4/+3
| | | | | | | | | | | The #relation method gets called in four places and the return value was instantly cloned in three of them. The only place that did not clone was ActiveRecord::Scoping::Default::ClassMethods#unscoped. This introduced a bug described in #5667 and should really clone the relation, too. This means all four places would clone the relation, so it doesn't make a lot of sense caching it in the first place. The four places with calls to relations are: activerecord/lib/active_record/scoping/default.rb:110:in `block in build_default_scope'" activerecord/lib/active_record/scoping/default.rb:42:in `unscoped'" activerecord/lib/active_record/scoping/named.rb:38:in `scoped'" activerecord/lib/active_record/scoping/named.rb:52:in `scope_attributes'"
* Add ActiveRecord::Base#slice to slice method callsGuillermo Iguaran2012-03-291-0/+6
|
* ActiveRecord::Core#initialize: improve performanceBogdan Gusiev2012-03-151-1/+1
|
* Fix GH #5399. connection_pools's keys are ↵kennyj2012-03-141-1/+1
| | | | ActiveRecord::Base::ConnectionSpecification objects.
* Initialize @stale_state to nil in associationCarlos Antonio da Silva2012-03-041-1/+0
| | | | | | | | | | | | | This apparently fix the warning related to @new_record variable not being initialized in AR's test suit, when an association is built and the object is marshalled/loaded. See these tests in AR's base_test.rb: test_marshalling_with_associations test_marshalling_new_record_round_trip_with_associations Closes #3720.
* Rename field_changed? to _field_changed? so that users can create a field ↵Akira Matsuda2012-02-141-1/+1
| | | | named field
* Merge branch 'master' into instance_readerAaron Patterson2012-02-091-1/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (30 commits) Bump tzinfo. 0.3.31 was released on November 6, 2011. Fix GH #4909. Dependency on TZInfo move from AR to AS. moving ordered hash to normal hash because ruby 1.9.3 hash defaultly ordered one Refactored the OrderedHash related stuff Replaced OrderedHash usage with Ruby 1.9 Hash Replaced OrderedHash with Hash for ruby 1.9 series removed unnecessary code replacing the orderhash with hash for ruby-1.9 Clean up some wording. Fix typo. test title changed corresponding to the test replaced active support ordered hash to ruby hash on active resource PostgreSQL does not work in the same way of the other adapters AR::Relation#pluck: improve to work with joins Fix match docs Fix attribute_before_type_cast for serialized attributes. Fixes #4837. Fix failing request test Fixes in AMo README Update README to mention lint. Trim down Active Model API by removing valid? and errors.full_messages ...
| * Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-02-091-1/+1
| |\ | | | | | | | | | | | | Conflicts: activerecord/lib/active_record/relation/query_methods.rb
| | * Correcting ActiveRecord::Core#encode_with docsJosef Šimánek2012-02-071-1/+1
| | |
| * | Fix attribute_before_type_cast for serialized attributes. Fixes #4837.Jon Leighton2012-02-071-0/+2
| |/
* | wrap and cache columns for typecastingAaron Patterson2012-02-071-2/+2
| |
* | column types are passed from the result set to the instantiated AR objectAaron Patterson2012-02-071-2/+3
| |
* | copy the columns hash to the active record instances, typecast using columns ↵Aaron Patterson2012-02-071-0/+2
|/ | | | looked up on the instance
* has_many/has_one, :dependent => :restrict, deprecation added.Manoj2012-01-291-0/+10
|
* The primary key is always initialized in the @attributes hash to nil (unlessAaron Patterson2012-01-251-0/+5
| | | | another value has been specified).
* change AR default_timezone to :utc since it's the default for AR::RailtieAkira Matsuda2012-01-211-3/+3
|
* Fix another race condition.Jon Leighton2012-01-201-0/+3
| | | | | | From 2c667f69aa2daac5ee6c29ca9679616e2a71532a. Thanks @pwnall for the heads-up.
* push ivar initialization down to a common methodAaron Patterson2012-01-191-16/+20
|
* AS::Callbacks: remove unused runnerBogdan Gusiev2012-01-121-1/+1
|
* Fixed after_initialize callbacks call on AR model #dupBogdan Gusiev2012-01-071-1/+1
|
* No need to override to_yaml and yaml_initialize methods in ActiveRecord::CoreRafael Mendonça França2012-01-041-20/+0
|