Commit Graph

2769 Commits

Author SHA1 Message Date
Jeremy Kemper
4300f94533 Revert "Remove connection method definition, since it's called just once."
Restore the connection method which was added so it can be overridden.

This reverts commit e428c75d2b.
2010-01-07 13:30:51 -08:00
José Valim
423e2acbb7 Merge remote branch 'eloy/master' 2010-01-07 20:13:07 +01:00
José Valim
a25ef06956 Allow to specify default attributes names translation in I18n yml files.
For example, you could easily specify :created_at and :updated_at translations as:

  en:
    attributes:
      created_at: "Created at"
      updated_at: "Updated at"

This configuration is built on ActiveModel, so it means those translations are
shared between different ORMs as well (but always as a fallback).
2010-01-07 15:31:50 +01:00
José Valim
821a160a49 Add a deprecation message to activerecord.errors. 2010-01-07 15:31:49 +01:00
José Valim
190ce3ab37 Errors messages are now moved from :activerecord.errors to simply :errors on I18n yml files. 2010-01-07 15:31:49 +01:00
Eloy Duran
9550916903 Raise a RecordNotFound if an ID in nested attributes is given but doesn't return a record. [#2415 state:resolved] 2010-01-07 13:19:49 +01:00
Eloy Duran
b6264c43f4 Moved the validation logic to the association reflection and refactored autosave_association.rb a bit. 2010-01-07 13:19:48 +01:00
Eloy Duran
fc6aae3459 Remove deprecated '_delete' option from NestedAttributes. 2010-01-07 13:19:48 +01:00
Eloy Duran
a559260e41 Removed unnecessary call to #try and cleaned up a bit more. 2010-01-07 13:19:48 +01:00
Eloy Duran
f866ced24a Don't use strings for callbacks, as these will be evaled. Rather use symbols, which uses a direct method dispatch.
Patch by Comron Sattari. [#3429 state:resolved]
2010-01-07 13:19:48 +01:00
Eloy Duran
2171e0a1d1 Cleanup some code in nested_attributes.rb, autosave_association.rb, and associations.rb with AssociationReflection#collection_association?
Also cache the result value.
2010-01-07 13:19:48 +01:00
Eloy Duran
f82adc7c5a Add AssociationReflection#collection_association? which returns true if it's for a has_many or has_and_belongs_to_many association. 2010-01-07 13:19:48 +01:00
Eloy Duran
1afa9fa5a9 Refactored nested attributes a bit around :reject_if => :all_blank. 2010-01-07 13:19:48 +01:00
José Valim
0c2d933f36 Ensure before_validation and after_validation accepts :on as option. 2010-01-06 22:24:16 +01:00
Jeffrey Hardy
caad6c634c Restore require of 'active_record/fixtures' for Rake tasks that use them 2010-01-06 13:58:27 -05:00
Jeffrey Hardy
894ce15534 Use better defaults for fixtures: transactional=true, instantiated=false
These reflect the settings that were previously included in the default
test_helper.rb, removed in d7d9173.
2010-01-06 13:38:11 -05:00
Jeffrey Hardy
891ba18d65 Update db:migrate error message to reflect the removal of config.frameworks 2010-01-06 13:37:45 -05:00
Joshua Peek
e5ed62deea Autoload AR test case 2010-01-04 16:50:01 -06:00
Joshua Peek
2601a16ede Autoload AS test case 2010-01-04 16:22:46 -06:00
David Heinemeier Hansson
5e94d3e3ea Merge 2010-01-03 22:27:28 -08:00
David Heinemeier Hansson
1459c8cc1d Changed ActiveRecord::Base.store_full_sti_class to be true by default reflecting the previously announced Rails 3 default [DHH] 2010-01-03 19:30:28 -08:00
José Valim
eca11bfdb5 Merge branch 'master' of git://github.com/rails/rails 2010-01-04 01:05:19 +01:00
José Valim
3990310a2b Use underscore in notification namespaces. 2010-01-04 00:03:56 +01:00
Pratik Naik
a68165833a Add Relation#create_with to explictily specify create scope 2010-01-04 03:50:16 +05:30
Pratik Naik
a115b5d79a Ensure using proper engine for Arel::Table 2010-01-04 02:05:18 +05:30
José Valim
6fbe9ef2ff Use namespaces in notifications. 2010-01-03 20:39:42 +01:00
Pratik Naik
00f3f6dc31 Relation#merge and Relation#except should respect locks 2010-01-03 21:25:19 +05:30
Pratik Naik
3db876cb76 Relation#merge and Relation#except should respect havings 2010-01-03 20:50:04 +05:30
Pratik Naik
af5e1b4cc6 Add Relation#except 2010-01-03 19:43:29 +05:30
Pratik Naik
22bfd8b098 Rename a variable name for consistency 2010-01-03 19:20:40 +05:30
Pratik Naik
8edfa8f82f Move Relation#spawn and Relation#merge to a separate module 2010-01-03 18:57:57 +05:30
Pratik Naik
3eca0ab838 Give preference to the second relation's order when merging 2010-01-03 18:52:30 +05:30
Pratik Naik
4939f95c9b Reapply "Remove optional join_dependency argument as Relation always supplies it" - Now without syntax errors 2010-01-03 11:08:57 +05:30
Jeremy Kemper
8571aa613f Revert "Remove optional join_dependency argument as Relation always supplies it"
This reverts commit 8e57deed8b.
2010-01-02 18:39:36 -08:00
Pratik Naik
8e57deed8b Remove optional join_dependency argument as Relation always supplies it 2010-01-03 04:09:36 +05:30
Pratik Naik
47da00e94b Further simplify Relation#references_eager_loaded_tables? 2010-01-03 03:58:34 +05:30
Pratik Naik
e9ebf8b898 Cache Relation#to_sql 2010-01-03 03:56:21 +05:30
Pratik Naik
0d1a2a3c22 Remove unused code from association.rb now that Relation takes care of checking the referenced tables 2010-01-03 03:49:10 +05:30
Pratik Naik
eb7fdb9464 Make Relation#includes behave exactly like the existing :include option 2010-01-03 03:46:08 +05:30
Pratik Naik
6f5f23aaa7 Add Relation#includes to be an equivalent of current finder option :include 2010-01-03 03:24:28 +05:30
Pratik Naik
c51347152a Get rid of Model.construct_finder_arel_with_includes. Use construct_finder_arel instead 2010-01-03 03:08:01 +05:30
Pratik Naik
a9c790e10f Simply methods for checking eager loaded tables references in the query 2010-01-03 03:00:30 +05:30
José Valim
7cc0a4cfa1 Use activerecord.errors.format as in Rails 2.3.5. 2010-01-02 22:27:02 +01:00
José Valim
dcafe995bf Make nested attributes behave like in 2.3.5 and add a sanity test for it with I18n. 2010-01-02 22:27:02 +01:00
Pratik Naik
ac1df91e5e Implement Relation#create and Relation#create! 2010-01-03 00:16:14 +05:30
Pratik Naik
65200d2933 Implement Relation#new 2010-01-03 00:08:59 +05:30
Pratik Naik
32b48bf419 Use arel predicates instead of strings wherever possible when merging relations 2010-01-02 22:43:40 +05:30
Pratik Naik
f1acf1cc74 Give higher preference to second relation's equality predicates when merging 2010-01-02 21:16:16 +05:30
Pratik Naik
7ff131f740 Make sure not to spalt string arguments 2010-01-02 13:43:50 +05:30
Pratik Naik
4a7a14b0e1 Use relations to build uniqueness conditions 2010-01-02 03:46:08 +05:30