Commit Graph

3593 Commits

Author SHA1 Message Date
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
43f9622c67 fix test 2012-03-30 14:37:37 +01:00
Jon Leighton
bd40e5c9e4 whitespace ✂️ 2012-03-30 14:36:33 +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
Carlos Antonio da Silva
f50c160cd0 Deprecate Column#type_cast_code 2012-03-29 23:04:51 -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
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
Arun Agrawal
4cd0b4e7c3 removed unused variables 2012-03-27 15:06:14 +05:30
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
Aaron Patterson
b4115fdbc0 properly namespace the fixture exception 2012-03-22 16:25:48 -07: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
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
Sandeep
70a19b7d42 changed all.map to pluck 2012-03-19 15:17:49 +05:30
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
Ruben Davila
9679d4015e Fix typo in ActiveRecord::Relation#blank? test 2012-03-17 12:22:54 -05: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
Rafael Mendonça França
404d785d29 Fix ActiveRecord::Relation#blank? tests 2012-03-16 17:05:35 -03:00
José Valim
8d87d5c947 Merge pull request #5469 from yakko/master
tests for Relation .present? .blank?
2012-03-16 07:37:13 -07:00
Thiago Almeida
964ed6e802 test relation presence fix 2012-03-16 11:30:24 -03:00
Thiago Almeida
4498f93e68 tests for Relation .present? and .blank? are check cases and shouldn't force sql-count 2012-03-16 11:04: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
Yasuo Honda
0ecba955e0 Address the dump file format for hstore 2012-03-15 14:12:47 -04: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
kennyj
fdb8805cdd Fix GH #5399. connection_pools's keys are ActiveRecord::Base::ConnectionSpecification objects. 2012-03-14 02:11:40 +09:00
Aaron Patterson
0210c44cd3 make sure connections returned after close are marked as in_use 2012-03-12 11:51:28 -07:00
Andrew White
eee32af45e Add dynamic find_or_create_by_{attribute}! method. 2012-03-12 14:16:19 +00:00
Denis Jean
a2c2f40661 fix activerecord query_method regression with offset into Fixnum
add test to show offset query_methods on mysql & mysql2

change test to cover public API
2012-03-12 17:44:10 +05:30
Alexey Vakhov
48a7df9a9f In AR depths use &:to_i before :uniq to process mixed arrays likes ["1", 1] correct 2012-03-09 15:21:12 +04:00
Aaron Patterson
657095d8bb ensure that released connections move between threads 2012-03-08 16:12:49 -08:00
Aaron Patterson
d523504c2f make active_connection? return true only if there is an open connection in use for the current thread. fixes #5330 2012-03-08 15:40:23 -08:00
José Valim
58a55595ca Merge pull request #5306 from kennyj/fix_69c7f02
Change the message string to use in  test case.
2012-03-08 04:00:02 -08:00
Jon Leighton
104eebb4cc Merge pull request #5289 from rafaelfranca/fix-through-associations
Fix has_many through associations when mass_assignment_sanitizer is strict
2012-03-08 00:13:08 -08:00
Nick Rogers
2931f413a5 Tests for removing a HABTM association when optimistic locking is enabled. 2012-03-07 23:56:23 -05:00
Aaron Patterson
447ecb08ca Merge pull request #5162 from kennyj/schema_cache_dump
[Proposal] Schema cache dump
2012-03-07 16:44:50 -08:00
Rafael Mendonça França
c9c7ee7710 Not need to pass join attributes to association build 2012-03-07 21:07:29 -03:00
kuahyeow
a149612c0b Add tests to test that through associations are not readonly, and we can update the records we retrive from the association 2012-03-08 09:48:59 +13:00
Aaron Patterson
89cef0757a Merge pull request #5315 from travisjeffery/enhance_postgresql_adapter_schema_support
Enhance PostgreSQL Adapter schema support
2012-03-07 10:58:55 -08:00
Travis Jeffery
8dc1a625c8 Adds #create/drop_schema on the PostgreSQL Adapter. 2012-03-07 17:55:33 +00:00
kennyj
cdfcbc48b2 Don't reset inheritance_column when setting explicitly. 2012-03-08 00:00:58 +09:00
Mattias Pfeiffer
3d8592657f Change syntax to accept an AR::Relation instead of old conditions hash/array. 2012-03-07 15:59:28 +01:00
kennyj
37802dd51e Change the string to use in test case. 2012-03-07 23:33:52 +09:00
Mattias Pfeiffer
6185c4947e Add :conditions option to uniqueness validator 2012-03-07 13:49:45 +01:00
Jacob Green
04aca254cc attribute_present? should return false for empty strings 2012-03-06 22:32:29 -08:00
Travis Jeffery
577971f05a Add #schema_names to PostgreSQL Adapter. 2012-03-07 05:27:12 +00:00