aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record.rb
Commit message (Collapse)AuthorAgeFilesLines
* Set the inverse when association queries are refinedJon Leighton2013-05-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Suppose Man has_many interests, and inverse_of is used. Man.first.interests.first.man will correctly execute two queries, avoiding the need for a third query when Interest#man is called. This is because CollectionAssociation#first calls set_inverse_instance. However Man.first.interests.where("1=1").first.man will execute three queries, even though this is obviously a subset of the records in the association. This is because calling where("1=1") spawns a new Relation object from the CollectionProxy object, and the Relation has no knowledge of the association, so it cannot set the inverse instance. This commit solves the problem by making relations spawned from CollectionProxies return a new Relation subclass called AssociationRelation, which does know about associations. Records loaded from this class will get the inverse instance set properly. Fixes #5717. Live commit from La Conf! :sparkles:
* Merge pull request #10152 from Noemj/statement_cacheRafael Mendonça França2013-04-101-0/+1
|\ | | | | | | | | | | | | Statement cache Conflicts: activerecord/CHANGELOG.md
| * Added statement cacheNoemj2013-04-101-0/+1
| |
* | Created a runtime registry for thread local variables in active record.wangjohn2013-04-091-0/+1
| |
* | Sort modules in alphabetical order.Shunsuke Osa2013-04-051-2/+2
| |
* | Extract Oracle database tasks.kennyj2013-04-031-0/+1
| |
* | Extract Sqlserver database tasks.kennyj2013-04-031-0/+1
| |
* | Extract Firebird database tasks.kennyj2013-04-031-0/+2
|/
* Updated copyright notices for 2013Andrew Nesbitt2012-12-311-1/+1
|
* Remove observers and sweepersRafael Mendonça França2012-11-281-1/+0
| | | | | | | | They was extracted from a plugin. See https://github.com/rails/rails-observers [Rafael Mendonça França + Steve Klabnik]
* Remove ActiveRecord::ModelJon Leighton2012-10-261-1/+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.
* Extract ActiveRecord::SessionStore from RailsPrem Sichanugrist2012-08-241-11/+0
| | | | | This functionality will be available from gem `active_record-session_store` instead.
* Get rid of config.preload_frameworks in favor of config.eager_load_namespacesJosé Valim2012-08-211-0/+9
| | | | | | | The new option allows any Ruby namespace to be registered and set up for eager load. We are effectively exposing the structure existing in Rails since v3.0 for all developers in order to make their applications thread-safe and CoW friendly.
* Renaming active_record_deprecated_finders to activerecord-deprecated_findersJon Leighton2012-08-171-1/+1
| | | | For consistency with the other AR extension plugins we are creating.
* Don't eager load all thisSantiago Pastorino2012-08-031-32/+33
| | | | | Some are loaded from Base which is loaded when a model inherits from it and some others are used in rake tasks
* defines a private require-hub active_support/railsXavier Noria2012-08-021-0/+1
| | | | | | | | This is a private place to put those AS features that are used by every component. Nowadays we cherry-pick individual files wherever they are used, but that it is not worth the effort for stuff that is going to be loaded for sure sooner or later, like blank?, autoload, concern, etc.
* removes the AR session store from eager loaded code [fixes #7160]Xavier Noria2012-07-291-1/+10
| | | | | See the comment in the file activerecord/lib/active_record.rb added by this patch for the rationale.
* Revert "Removing composed_of from ActiveRecord."Rafael Mendonça França2012-07-271-0/+1
| | | | | | | | | | | 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
* Removing composed_of from ActiveRecord.Steve Klabnik2012-06-181-1/+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
* db:create for PostgreSQL pulled out into a class.Pat Allan2012-06-171-0/+2
|
* db:create for MySQL now much cleaner.Pat Allan2012-06-171-0/+2
|
* A beginning of sorts.Pat Allan2012-06-171-0/+6
| | | | Minimal implementation that supports db:create SQLite replacement
* SchemaMigration should be loaded lazily.kennyj2012-05-291-0/+1
|
* Fix the buildSantiago Pastorino2012-05-221-1/+0
|
* require active_support/lazy_load_hooks where is neededSantiago Pastorino2012-05-221-0/+1
|
* Lazy load I18nSantiago Pastorino2012-05-111-2/+3
|
* clean up implementation of dynamic methods. use method compilation etc.Jon Leighton2012-05-041-2/+0
|
* add active_record_deprecated_finders as a depJon Leighton2012-04-121-0/+1
|
* Remove IdentityMapCarlos Antonio da Silva2012-03-131-1/+0
|
* Added `none` query method to return zero records.Juanjo Bazán2012-01-311-0/+1
| | | And added NullRelation class implementing the null object pattern for the `Relation` class.
* Merge pull request #4248 from andrew/2012Vijay Dev2011-12-311-1/+1
|\ | | | | Updated copyright notices for 2012
| * Updated copyright notices for 2012Andrew Nesbitt2011-12-311-1/+1
| |
* | Support establishing connection on ActiveRecord::Model.Jon Leighton2011-12-281-0/+1
| | | | | | | | | | This is the 'top level' connection, inherited by any models that include ActiveRecord::Model or inherit from ActiveRecord::Base.
* | Support configuration on ActiveRecord::Model.Jon Leighton2011-12-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem: We need to be able to specify configuration in a way that can be inherited to models that include ActiveRecord::Model. So it is no longer sufficient to put 'top level' config on ActiveRecord::Base, but we do want configuration specified on ActiveRecord::Base and descendants to continue to work. So we need something like class_attribute that can be defined on a module but that is inherited when ActiveRecord::Model is included. The solution: added ActiveModel::Configuration module which provides a config_attribute macro. It's a bit specific hence I am not putting this in Active Support or making it a 'public API' at present.
* | Deal with global config better between AR::Base and AR::ModelJon Leighton2011-12-241-0/+1
| |
* | Start work towards making AR include-able.Jon Leighton2011-12-241-0/+2
| |
* | DeprecatedUnderscoreRead does not exist anymoreAaron Patterson2011-12-211-1/+0
| |
* | Move DefaultScope and NamedScope under ScopingJon Leighton2011-12-151-2/+9
| |
* | Split out most of the AR::Base code into separate modules :cake:Jon Leighton2011-12-151-3/+14
| |
* | Move delegation reponsibilities of Relation to a module. Also precompile ↵José Valim2011-12-151-0/+1
| | | | | | | | method missing calls for rofscale.
* | implements automatic EXPLAIN logging for slow queriesXavier Noria2011-12-021-0/+2
| |
* | Get rid of the underscore versions of attribute methods!Jon Leighton2011-12-011-0/+1
| | | | | | | | This makes me happy!
* | Extract attribute serialization code into a separate moduleJon Leighton2011-11-301-0/+1
| |
* | Added ActiveRecord::Base.store for declaring simple single-column key/value ↵David Heinemeier Hansson2011-10-131-0/+1
| | | | | | | | stores [DHH]
* | stop messing with the load path, load path should be adjusted in the test taskAaron Patterson2011-08-261-7/+0
| |
* | In 1efd88283ef68d912df215125951a87526768a51, ConnectionAdapters was put ↵Jon Leighton2011-08-161-1/+2
| | | | | | | | under eager_autoload. Due to the requires in that file, this caused ConnectionSpecification to be loaded, which references ActiveRecord::Base, which means the database connection is established. We do not want to connect to the database when Active Record is loaded, only when ActiveRecord::Base is first referenced by the user.
* | lazy load ConnectionAdapters remove require.Vishnu Atrai2011-07-221-1/+2
|/
* Rewrote AssociationPreload.Jon Leighton2011-02-281-1/+0
|
* We're in 2011, let's update our licensePrem Sichanugrist2011-02-221-1/+1
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Merge remote branch 'rails/master' into identity_mapEmilio Tagua2011-02-151-0/+4
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/examples/performance.rb activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/lib/active_record/associations/association_proxy.rb activerecord/lib/active_record/autosave_association.rb activerecord/lib/active_record/base.rb activerecord/lib/active_record/nested_attributes.rb activerecord/test/cases/relations_test.rb