aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
Commit message (Collapse)AuthorAgeFilesLines
* move apply_finder_options to active_record_deprecated_findersJon Leighton2012-04-121-22/+0
|
* Merge pull request #5720 from kennyj/should_use_klass_methodJon Leighton2012-04-111-1/+1
|\ | | | | Get a properly aliased_table_name, when we use a polymorphic association.
| * Get a properly aliased_table_name, when we use a polymorphic association.kennyj2012-04-041-1/+1
| |
* | Override AR::Relation methods in NullRelation.Juanjo Bazán2012-04-111-0/+53
| | | | | | So a NullRelation (Relation#none) is chainable with database methods.
* | Corrected grammatical errors in schema_dumper and scoping/defaultdcurtis2012-04-102-2/+2
| |
* | Fix delete_all when chained with joins.Rafael Mendonça França2012-04-103-16/+40
| | | | | | | | Closes #5202 and #919
* | Merge pull request #5718 from benedikt/masterJeremy Kemper2012-04-082-6/+5
|\ \ | | | | | | Removes caching from ActiveRecord::Core::ClassMethods#relation
| * | Removes caching from ActiveRecord::Core::ClassMethods#relationBenedikt Deicke2012-04-032-6/+5
| |/ | | | | | | | | | | | | | | | | | | | | 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'"
* | fix markup error [ci skip]Vijay Dev2012-04-081-1/+1
| |
* | Merge pull request #5716 from jurriaan/tr-gsub-cleanupSantiago Pastorino2012-04-042-3/+3
|\ \ | | | | | | Updated/changed unneeded tr/gsubs
| * | Updated/changed useless tr/gsubsJurriaan Pruis2012-04-032-3/+3
| |/
* | Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-04-041-3/+3
|\ \ | | | | | | | | | | | | Conflicts: guides/source/engines.textile
| * | Remove unnecessary articles.Waseem Ahmad2012-04-031-3/+3
| |/
* | DATABASE_URL allows omission of database.ymlTim Pope2012-04-031-1/+3
| |
* | use File.binread to pull in the schema cacheAaron Patterson2012-04-031-1/+1
|/
* Fix #5667. Preloading should ignore scoping.Jon Leighton2012-03-301-2/+3
|
* clear up duplication between Persistence#destroy and Locking#destroyJon Leighton2012-03-302-27/+34
|
* Merge pull request #5334 from courtland/masterJon Leighton2012-03-301-0/+2
|\ | | | | Fix deleting from a HABTM join table upon destroying an object of a model with optimistic locking enabled.
| * Fix deleting from a HABTM join table upon destroying an object of a model ↵Nick Rogers2012-03-071-0/+2
| | | | | | | | with optimistic locking enabled. Issue #5332.
* | Add Relation#find_by and Relation#find_by!Jon Leighton2012-03-302-0/+20
| |
* | Merge pull request #2945 from Casecommons/nested_attributes_moduleJon Leighton2012-03-301-1/+1
|\ \ | | | | | | Nested attribute setters can be overridden.
| * | Nested attribute setters can be overridden.Jonathan Mukai & Peter Jaros2012-03-281-1/+1
| | | | | | | | | | | | Overriding implementation can call super.
* | | recurse in read_attribute we get caching / don't duplicate codeJon Leighton2012-03-301-3/+2
| | |
* | | Deprecate Column#type_cast_codeCarlos Antonio da Silva2012-03-291-0/+4
| | |
* | | Properly typecast id attribute when using custom primary keyCarlos Antonio da Silva2012-03-291-1/+4
| | |
* | | Add ActiveRecord::Base#slice to slice method callsGuillermo Iguaran2012-03-291-0/+6
| | |
* | | Merge pull request #4843 from seamusabshere/patch-1Xavier Noria2012-03-281-1/+1
|\ \ \ | |/ / |/| | Possibly clearer way of getting rid of ` and "
| * | thanks to @jurriaanSeamus Abshere2012-02-141-1/+1
| | |
| * | Possibly clearer way of getting rid of ` and " Seamus Abshere2012-02-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Incidentally it's also faster... >> a = 'hello "id` world'; Benchmark.realtime { 500_000.times { a.tr('`"', "") } } => 0.7388770580291748 >> a = 'hello "id` world'; Benchmark.realtime { 500_000.times { a.gsub(/[`"]/, "") } } => 1.7843739986419678
* | | much code can be deleted thanks to @tenderlove's refactoringJon Leighton2012-03-283-72/+6
| | |
* | | Remove Arel::Relation constant from PredicateBuilder.Juanjo Bazán2012-03-271-2/+2
| | |
* | | attributes are cached by string keys, so to_s to support symbols. fixes #5549Aaron Patterson2012-03-271-1/+1
| | |
* | | Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-03-272-2/+2
|\ \ \
| * | | Missing generated query for pluck method. Juanjo Bazán2012-03-271-1/+1
| | | | | | | | | | | | (and changed the use of true for a more database agnostic example).
| * | | Use one 'be'.Waseem Ahmad2012-03-241-1/+1
| | | |
* | | | Merge pull request #5582 from chendo/masterXavier Noria2012-03-261-1/+1
|\ \ \ \ | | | | | | | | | | Remove "needless boolean casting"
| * | | | Remove 'needless boolean casting'.Jack Chen (chendo)2012-03-261-1/+1
| |/ / / | | | | | | | | | | | | | | | | "Predicates in Rails rely on standard Ruby semantics for boolean values and guarantee no singletons whatsoever." - @fxn
* | | | Merge pull request #2621 from icco/masterAaron Patterson2012-03-261-1/+1
|\ \ \ \ | | | | | | | | | | Issue with schema dump
| * | | | Not checking for nil is apparently a lot faster.Nat Welch2011-09-211-1/+1
| | | | |
| * | | | Merge branch 'master' of git://github.com/rails/railsNat Welch2011-09-2132-1609/+1554
| |\ \ \ \
| * | | | | From @dasch's recommendation.Nat Welch2011-08-221-1/+1
| | | | | |
| * | | | | Fixes bug with schema dumper when using with Padrino.Nat Welch2011-08-211-1/+1
| | | | | |
* | | | | | ActiveRecord::Coders::YAMLColumn#dump should raise an errorGuten2012-03-261-1/+7
| |_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | closes #2737 Conflicts: activerecord/lib/active_record/coders/yaml_column.rb
* | | | | Merge branch 'master' of github.com:lifo/docrailsVijay Dev2012-03-242-1/+15
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: guides/source/ruby_on_rails_guides_guidelines.textile
| * | | | | Adding documentation for ActiveRecord::Base.abstract_class to clarify a ↵Joe Goggins2012-03-221-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | particular usecase for this feature (to allow you to use inheritance in ActiveRecord without using the STI table name
| * | | | | Correct description of ['migrated_at > ?', 1.week.ago] from "more than a ↵Dave Burt2012-03-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | week ago" to "more recently than a week ago."
* | | | | | properly namespace the fixture exceptionAaron Patterson2012-03-221-6/+2
| | | | | |
* | | | | | Deprecate eager-evaluated scopes.Jon Leighton2012-03-212-12/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use this: scope :red, where(color: 'red') default_scope where(color: 'red') Use this: scope :red, -> { where(color: 'red') } default_scope { where(color: 'red') } The former has numerous issues. It is a common newbie gotcha to do the following: scope :recent, where(published_at: Time.now - 2.weeks) Or a more subtle variant: scope :recent, -> { where(published_at: Time.now - 2.weeks) } scope :recent_red, recent.where(color: 'red') Eager scopes are also very complex to implement within Active Record, and there are still bugs. For example, the following does not do what you expect: scope :remove_conditions, except(:where) where(...).remove_conditions # => still has conditions
* | | | | | Avoid obscure &Proc.new thingJon Leighton2012-03-211-2/+2
| | | | | |
* | | | | | Remove valid_scope_name? check - use rubyJon Leighton2012-03-211-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | scope is syntactic sugar for defining a class method. Ruby allows redefining methods but emits a warning when run with -w. So let's not implement our own logic for this. Users should run with -w if they want to be warned about redefined methods.