Jon Leighton
012bab8c9f
Merge pull request #5832 from kennyj/fix_5267
...
Fix a wrong return value from reset_sequence_name method.
2012-04-13 08:54:14 -07:00
Jon Leighton
1391d74e41
move some of the update_all implementation to active_record_deprecated_finders
2012-04-13 16:47:20 +01:00
kennyj
f49d76662e
Fix wrong return value from reset_sequence_name method.
2012-04-14 00:33:25 +09:00
Jon Leighton
60ac540053
now we can just manipulate the values hash in #only and #except
2012-04-13 16:17:52 +01:00
Jon Leighton
6311975fb3
use a hash to store relation values
2012-04-13 16:17:52 +01:00
Jon Leighton
7e0b6b2528
doesn't make sense for select! to take a block
2012-04-13 13:17:43 +01:00
Jon Leighton
be89e9a351
remove apply_finder_options call from AssociationScope
2012-04-13 13:17:43 +01:00
Jon Leighton
8d5be98ad7
Make Relation#extending work like other value methods
2012-04-13 13:17:43 +01:00
Jon Leighton
55ee6ed7dd
Add Relation#merge!
2012-04-13 13:17:43 +01:00
Jon Leighton
f52253cbeb
assert valid keys
2012-04-13 13:17:42 +01:00
Jon Leighton
0183193a6a
Allow Relation#merge to take a hash
2012-04-13 13:17:42 +01:00
Jon Leighton
e4f0fbd994
we have no need for the ASSOCIATION_METHODS constant
2012-04-13 13:17:42 +01:00
Jon Leighton
88d1fafc22
refactoring
2012-04-13 13:17:42 +01:00
Jon Leighton
3b86336694
Extract clusterfuck method for surgery
2012-04-13 13:17:42 +01:00
Reg Braithwaite
dcb2279674
mention that coercion only happens when the primary key is an integer and use +to_i+ formatting
2012-04-12 22:55:11 -04:00
Reg Braithwaite
859a91b59a
Documents that ActiveRecord's find by id uses to_i to coerce its arguments to integers
2012-04-12 22:24:21 -04:00
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
365b8b6db7
Fix #5563 . Should reflect the most recent change to either of association / id.
2012-04-13 02:25:19 +09:00
kennyj
0f3901e910
@stale_state should be nil when a model isn't saved.
2012-04-13 02:25:13 +09:00
Jon Leighton
8c2c60511b
Add bang versions of relation query methods.
...
The main reason for this is that I want to separate the code that does
the mutating from the code that does the cloning.
2012-04-12 17:57:54 +01: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
Doug Cole
cd6ddc865a
refactor configuration of insert_returning
2012-04-07 18:39:04 -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
Doug Cole
3a0d08163a
pick better names and add a little documentation
2012-04-01 15:23:06 -07:00
Doug Cole
20615e74cb
refactor
2012-03-31 18:13:55 -07:00
Doug Cole
3475051f7f
update mysql for new exec_insert signature
2012-03-31 18:13:40 -07:00
Doug Cole
f09bb33bb5
add use_returning as a postgresql connection config
2012-03-31 17:14:28 -07:00
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
Jon Leighton
884e5b7558
no need for cast
2012-03-21 20:25:51 +00:00
Jon Leighton
7c1275a005
no need for lvar
2012-03-21 20:23:46 +00:00
José Valim
14b2cf6a0a
Merge pull request #5532 from mhfs/migration_blank_line
...
Remove blank line from generated migration
2012-03-21 00:34:38 -07:00
Travis Jeffery
b2a59388b2
Generate Migration Thats Adds Removed Index
...
When generating a migration that removes a field with an index, the down
will add both the field and its index.
2012-03-21 01:20:35 +00:00
Marcelo Silveira
c63306b1a8
Remove blank line from generated migration
2012-03-20 21:44:45 -03:00
Dave Burt
a4b1423f4e
Correct description of ['migrated_at > ?', 1.week.ago] from "more than a week ago" to "more recently than a week ago."
2012-03-20 16:13:19 +11:00
José Valim
d802a6c275
Merge pull request #3329 from armstrjare/autosave_collection_new_record_bug
...
Autosave association doesn't save all records on a new record for a collection association if there are records marked for destruction
2012-03-18 04:13:28 -07:00
Jared Armstrong
f1903d8db7
Fix bug with autosave collection association on new record with a marked for destroy record in autosave collection.
2012-03-18 20:20:01 +13:00
Aaron Patterson
2b5cb1cd41
Merge pull request #5486 from kennyj/fix_5435
...
Fix GH #5435 . db:structure:dump should be re-enable.
2012-03-17 21:50:37 -07:00
Jonathan R. Wallace
9e09e8f526
Updates 'modyfing' typo to 'modifying'
2012-03-17 11:23:39 -04:00
José Valim
4711298767
Merge pull request #5321 from pfeiffer/uniqueness_validator_conditions
...
Add :conditions option to uniqueness validator
2012-03-17 07:13:58 -07:00
kennyj
0360b3eb1f
Fix GH #5435 . db:structure:dump should be reenable.
2012-03-17 13:57:10 +09:00
José Valim
6d0047aff8
Merge pull request #5467 from bogdan/initialize_callbacks
...
ActiveRecord::Core#initialize: improve performance
2012-03-16 05:34:16 -07:00
José Valim
fa7a3aaac7
Merge pull request #5461 from yakko/master
...
relation .present? and .blank? should not query SELECT COUNT(DISTINCT id)
2012-03-16 00:22:19 -07:00
Thiago Almeida
9d52b45a5b
relation .present? and .blank? should not query SELECT COUNT(DISTINCT id)
2012-03-16 01:14:24 -03:00
Aaron Patterson
e61e0c0b03
Merge pull request #5327 from kennyj/fix_explicitly_inheraitance_column
...
Don't reset inheritance_column when setting explicitly.
2012-03-15 18:31:20 -07:00
Aaron Patterson
e6c95fe391
errors should probably be logged as errors
2012-03-15 12:12:42 -07:00
Bogdan Gusiev
791251bf8b
ActiveRecord::Core#initialize: improve performance
2012-03-15 10:24:13 +02:00
kennyj
2d787f89f8
Fix GH #5430 . A Payload name for schema_search_path should be SCHEMA.
2012-03-15 02:07:01 +09:00
Carlos Antonio da Silva
a8dd21d8b4
Remove IdentityMap
2012-03-13 20:08:54 -03:00
Vijay Dev
800c70a8f9
Merge branch 'master' of github.com:lifo/docrails
2012-03-13 23:29:30 +05:30
kennyj
fdb8805cdd
Fix GH #5399 . connection_pools's keys are ActiveRecord::Base::ConnectionSpecification objects.
2012-03-14 02:11:40 +09:00
Aaron Patterson
0bb6fcb1d1
Merge pull request #5294 from robinroestenburg/master
...
Refactoring of `arel_attributes_values` method
2012-03-12 12:02:52 -07:00
Aaron Patterson
0210c44cd3
make sure connections returned after close are marked as in_use
2012-03-12 11:51:28 -07:00
Jonathan Rochkind
27ebb3dc8c
deprecated clear_stale_active_connections! can call #reap instead of no-op'ing, #reap does the same thing
2012-03-12 11:14:22 -04:00
Andrew White
ca99beb4a9
Add documentation for find_or_create_by_{attribute}! method.
2012-03-12 15:02:18 +00:00