Rodrigo Flores
944ed4b960
Revert "Added documentation to explain what happens if you don't set any values for the dependent option on has_many"
...
This reverts commit 820a677d8622a540188704941a31871ed4d61461.
2012-04-12 22:12:08 -03:00
Rodrigo Flores
820a677d86
Added documentation to explain what happens if you don't set any values for the dependent option on has_many
2012-04-12 21:51:35 -03:00
kennyj
611020b4dd
Fix typo on the add_index.
2012-04-13 01:25:58 +09:00
kennyj
1e417d5cd2
Some refactor for association.
...
* Remove unused association_class method.
* Remove a unnecessary assignment.
* Move @updated to BelongsToAssociation that only reference this instance variable.
* Reset @stale_state at the reset method. I think this place is right place.
2012-04-12 23:28:31 +09:00
Jon Leighton
eda65f391e
move apply_finder_options to active_record_deprecated_finders
2012-04-12 15:02:00 +01:00
Jon Leighton
dd2c9b9578
add active_record_deprecated_finders as a dep
2012-04-12 15:01:43 +01:00
Jon Leighton
19ecde00ff
Merge pull request #5720 from kennyj/should_use_klass_method
...
Get a properly aliased_table_name, when we use a polymorphic association.
2012-04-11 16:18:36 -07:00
Juanjo Bazán
1a20683f09
Override AR::Relation methods in NullRelation.
...
So a NullRelation (Relation#none) is chainable with database methods.
2012-04-11 15:24:23 +02:00
dcurtis
248fa70ccd
Corrected grammatical errors in schema_dumper and scoping/default
2012-04-10 22:05:43 -07:00
Rafael Mendonça França
6f6c2909dc
Fix delete_all when chained with joins.
...
Closes #5202 and #919
2012-04-10 23:45:01 -03:00
Jeremy Kemper
9f37f335f2
Merge pull request #5718 from benedikt/master
...
Removes caching from ActiveRecord::Core::ClassMethods#relation
2012-04-08 11:30:18 -07:00
Vijay Dev
cf9664adcf
fix markup error [ci skip]
2012-04-08 02:13:51 +05:30
Santiago Pastorino
a9398a7da4
Merge pull request #5716 from jurriaan/tr-gsub-cleanup
...
Updated/changed unneeded tr/gsubs
2012-04-04 10:43:24 -07:00
Vijay Dev
02b9c22df8
Merge branch 'master' of github.com:lifo/docrails
...
Conflicts:
guides/source/engines.textile
2012-04-04 12:42:22 +05:30
Tim Pope
a49944844f
DATABASE_URL allows omission of database.yml
2012-04-03 15:57:01 -07:00
Aaron Patterson
3b378a7840
use File.binread to pull in the schema cache
2012-04-03 15:57:01 -07:00
kennyj
bfb9b7165e
Get a properly aliased_table_name, when we use a polymorphic association.
2012-04-04 01:21:35 +09:00
Benedikt Deicke
68677ffb82
Removes caching from ActiveRecord::Core::ClassMethods#relation
...
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'"
2012-04-03 17:00:37 +02:00
Jurriaan Pruis
2d8396fc9f
Updated/changed useless tr/gsubs
2012-04-03 15:16:09 +02:00
Waseem Ahmad
a17874ee56
Remove unnecessary articles.
2012-04-03 05:41:07 +05:30
Jon Leighton
86aefdb4f2
Fix #5667 . Preloading should ignore scoping.
2012-03-30 16:19:32 +01:00
Jon Leighton
1ce75450a9
clear up duplication between Persistence#destroy and Locking#destroy
2012-03-30 14:39:55 +01:00
Jon Leighton
2eb111815d
Merge pull request #5334 from courtland/master
...
Fix deleting from a HABTM join table upon destroying an object of a model with optimistic locking enabled.
2012-03-30 06:08:05 -07:00
Jon Leighton
13b3c77e39
Add Relation#find_by and Relation#find_by!
2012-03-30 12:52:29 +01:00
Jon Leighton
3a8c54396e
Merge pull request #2945 from Casecommons/nested_attributes_module
...
Nested attribute setters can be overridden.
2012-03-30 03:25:30 -07:00
Jon Leighton
7dd7d76b86
recurse in read_attribute we get caching / don't duplicate code
2012-03-30 11:09:27 +01:00
Carlos Antonio da Silva
f50c160cd0
Deprecate Column#type_cast_code
2012-03-29 23:04:51 -03:00
Carlos Antonio da Silva
77a0fc1c7a
Properly typecast id attribute when using custom primary key
2012-03-29 22:59:30 -03:00
Guillermo Iguaran
01ede9a211
Add ActiveRecord::Base#slice to slice method calls
2012-03-29 17:48:35 -05:00
Jonathan Mukai & Peter Jaros
135d704a55
Nested attribute setters can be overridden.
...
Overriding implementation can call super.
2012-03-28 19:08:31 -04:00
Xavier Noria
bbd2caeaf9
Merge pull request #4843 from seamusabshere/patch-1
...
Possibly clearer way of getting rid of ` and "
2012-03-28 16:01:05 -07:00
Jon Leighton
6cff09038d
much code can be deleted thanks to @tenderlove's refactoring
2012-03-28 16:38:38 +01:00
Santiago Pastorino
a3e5b7bdf2
Merge pull request #5616 from cbartlett/migration-indent
...
Fix indenting in migration generator
2012-03-27 20:09:37 -07:00
Juanjo Bazán
2fa7ccf7ae
Remove Arel::Relation constant from PredicateBuilder.
2012-03-27 14:13:28 -07:00
Aaron Patterson
e96d04a2e4
attributes are cached by string keys, so to_s to support symbols. fixes #5549
2012-03-27 11:27:51 -07:00
Vijay Dev
b42fbd3ecb
Merge branch 'master' of github.com:lifo/docrails
2012-03-27 21:26:37 +05:30
Colin Bartlett
e5156c9564
Fix indenting in migration generator
...
$ rails generate migration remove_foo_from_bars foo:string
This currently generates:
def up
remove_column :bars, :foo
end
Fix it:
def up
remove_column :bars, :foo
end
2012-03-27 11:41:31 -04:00
Xavier Noria
ded74dfd8b
Merge pull request #5582 from chendo/master
...
Remove "needless boolean casting"
2012-03-26 18:14:48 -07:00
Aaron Patterson
41dfc46717
Merge pull request #2621 from icco/master
...
Issue with schema dump
2012-03-26 17:24:48 -07:00
Juanjo Bazán
fc25feb341
Missing generated query for pluck method.
...
(and changed the use of true for a more database agnostic example).
2012-03-27 00:08:31 +03:00
Guten
9637de6b47
ActiveRecord::Coders::YAMLColumn#dump should raise an error
...
closes #2737
Conflicts:
activerecord/lib/active_record/coders/yaml_column.rb
2012-03-26 21:57:39 +02:00
Jack Chen (chendo)
ef64c6ba8c
Remove 'needless boolean casting'.
...
"Predicates in Rails rely on standard Ruby semantics for boolean values
and guarantee no singletons whatsoever." - @fxn
2012-03-26 15:55:16 +11:00
Waseem Ahmad
9ff2e928ef
Use one 'be'.
2012-03-24 20:26:44 +05:30
Vijay Dev
014498e1d7
Merge branch 'master' of github.com:lifo/docrails
...
Conflicts:
guides/source/ruby_on_rails_guides_guidelines.textile
2012-03-24 17:15:10 +05:30
Aaron Patterson
b4115fdbc0
properly namespace the fixture exception
2012-03-22 16:25:48 -07:00
Joe Goggins
65a3020851
Adding documentation for ActiveRecord::Base.abstract_class to clarify a particular usecase for this feature (to allow you to use inheritance in ActiveRecord without using the STI table name
2012-03-22 10:02:08 -05:00
Marcelo Silveira
86d1dfb821
Avoid another blank line in generated migration and remove assertion as per @spastorino request
2012-03-21 19:28:34 -03:00
Jon Leighton
0a12a5f816
Deprecate eager-evaluated scopes.
...
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
2012-03-21 22:18:18 +00:00
Jon Leighton
fd68bd23b6
Avoid obscure &Proc.new thing
2012-03-21 20:37:22 +00:00
Jon Leighton
f6db31ec16
Remove valid_scope_name? check - use ruby
...
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.
2012-03-21 20:30:48 +00:00