Commit Graph

2836 Commits

Author SHA1 Message Date
Joshua Peek
7c84bbf160 Add wrap_with_notifications helper to AMo observing 2009-07-20 23:57:01 -05:00
Yehuda Katz
37658f15bb Merge branch 'master' of git@github.com:rails/rails 2009-07-19 13:21:17 -07:00
Yehuda Katz
5ffaaa71d1 Define ActiveModel API Compliance
- Define to_model on AR
  - Define to_model on ActiveModel::APICompliant
  - Update test fixtures to be API Compliant
  - Start using to_model in AP
2009-07-20 00:27:04 +09:00
Szymon Nowak
1c11437a32 Add primary_key option to belongs_to association
[#765 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-07-15 18:13:32 -07:00
Pratik Naik
40b387580f Use map! instead of map for <association>_ids 2009-07-13 21:59:06 +01:00
Pratik Naik
373b053dc8 Optimize <association>_ids for hm:t with belongs_to source 2009-07-13 16:29:19 +01:00
Joshua Peek
e83a05af07 Integrate AMo XML serializer into AR 2009-07-11 16:20:58 -05:00
Sam Goldstein
d60d7edce4 Make it so AR attributes which conflict with object-private methods (e.g. system) don't 'randomly' cause NoMethodErrors
Previously if you called this attribute before others, you'd get exceptions.  But if it was the second-or-subsequent attribute you retrieved you'd get the correct behaviour.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2808 state:committed]
2009-07-09 16:44:30 +12:00
Hongli Lai (Phusion)
187d90f752 Add support for dumping non-standard primary keys when using the SQLite3 adapter. Fix unit tests so that this feature is tested for all adapters. [#2868 state:resolved]
Signed-off-by: Yehuda Katz <wycats@yehuda-katzs-macbookpro41.local>
2009-07-07 16:17:25 -07:00
Joshua Peek
783db25e0c Integrate AMo JSON serializer into AR 2009-07-03 23:12:42 -05:00
Yehuda Katz + Carl Lerche
16dc139caa Added AR:B#dup method for duplicationg object without frozen attributes [#2859 state:resolved]
Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
2009-07-01 12:16:35 -07:00
Yehuda Katz + Carl Lerche
7583a24ee0 Move mocha down below initial T::U require and bump version to 0.9.7 [#2858 state:resolved] 2009-07-01 11:53:17 -07:00
Pratik Naik
45e6f19925 Revert "Revert "Generate proper :counter_sql from :finder_sql when there is a newline character immediately following 'SELECT' [#2118 state:resolved]""
This reverts commit 80f1f863cd.

The feature doesn't work on Postgres, so don't test it on Postgres.
Also, Postgres compatibility is irrelevant to the ticket/patch in question.
2009-07-01 00:02:00 +01:00
Carl Lerche
db3de78a83 Bump up the version to 3.0.pre 2009-06-30 14:37:12 -07:00
Justin French
7d548f795d Changed ActiveRecord::Base.human_name to underscore the class name before it humanizes it
This gives you 'Post comment' rather than 'Postcomment' by default.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2120 state:committed]
2009-06-30 15:24:04 +12:00
Michael Koziarski
b5dfdc714f Make sure the wrapped exceptions also have the original exception available.
[#2419 state:committed]
2009-06-26 17:01:21 +12:00
Michael Schuerig
00a5fd3d18 Translate foreign key violations to ActiveRecord::InvalidForeignKey exceptions.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-26 16:52:55 +12:00
Michael Schuerig
53a3eaa860 Translate adapter errors that indicate a violated uniqueness constraint to ActiveRecord::RecordNotUnique exception derived from ActiveReecord::StatementInvalid.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-26 16:52:54 +12:00
Yehuda Katz + Carl Lerche
80f1f863cd Revert "Generate proper :counter_sql from :finder_sql when there is a newline character immediately following 'SELECT' [#2118 state:resolved]"
This reverts commit 4851ca9e13.

The tests do not pass for postgresql.
2009-06-22 12:04:02 -07:00
Patrick Joyce
4851ca9e13 Generate proper :counter_sql from :finder_sql when there is a newline character immediately following 'SELECT' [#2118 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-06-21 22:07:23 +01:00
Joseph Wilk
eb30e4ca40 Fixed a bug where create_table could not be called without a block [#2221 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-06-21 19:51:32 +01:00
Brian Hogan
b26c2c11ab Ensure table names are quoted while renaming for sqlite3 adapter [#2272 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-06-21 18:24:19 +01:00
mattbauer
83c1934003 Ensure hm:t#create respects source associations hash conditions [#2090 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-06-21 17:35:04 +01:00
Joshua Peek
d5d59230f4 Simplify AMo validation attribute reader 2009-06-17 21:27:54 -05:00
Yehuda Katz + Carl Lerche
7ac9f29093 Updated require for AMo move 2009-06-17 13:05:14 -07:00
Joshua Peek
1c4d28ba31 Move model naming into ActiveModel 2009-06-17 10:37:39 -05:00
Xavier Noria
d32965399c uses Object#metaclass and Object#class_eval in a few spots
[#2797 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-06-12 16:14:06 -07:00
Adam Milligan
54a5446641 HasOneThroughAssociation still shouldn't derive from HasManyThroughAssociation.
[#1642 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-06-12 13:52:51 -07:00
Emilio Tagua
8db190acba HasOneAssociation inherits AssociationProxy since it shares nothing with BelongsToAssociation.
[#2796 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-06-12 13:45:25 -07:00
Joshua Peek
8f7c657f4b Move observing notify helper into AMo 2009-06-11 13:41:48 -05:00
Joshua Peek
4d70359200 Integrate ActiveModel::Observing into ActiveRecord 2009-06-10 23:36:44 -05:00
Michael Koziarski
c014c3e5c1 Whitelist the methods which are called by multiparameter attribute assignment.
This prevents users from causing NoMethodErrors and the like by editing the parameter names, and closes a potential exploit of CVE-2009-1904.
2009-06-10 12:12:21 +12:00
Raimonds Simanovskis
63091cef2e disabled base_test.rb tests that were not Oracle compatible (TIME datatype is not supported on Oracle, UPDATE does not support ORDER BY) _before_type_cast on Oracle returns Time and not String added Oracle specific schema definition that was missing for test_default_values test
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-09 20:26:55 +12:00
Eugene Pimenov
74c1249d07 PostgreSQL adapter should call thread safe quote_string function
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2009-06-09 20:12:01 +12:00
Jeremy Kemper
6e73cf6bdf Fix AR json encoding 2009-06-08 19:37:51 -07:00
Jeremy Kemper
d9f16fafec Update for Active Model yielding per error not per attribute 2009-06-08 19:37:50 -07:00
Giles Alexander
532219fd09 Schema dumper now records scale 0 decimal columns as decimal not integer.
The schema dumper would dump out any decimal or numeric column that had a zero
scale as an integer column. This will cause problems for very large precision
columns on some DBMSs, particularly PostgreSQL. It also looks strange to see
your column change type after moving through schema.rb.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2741 state:committed]
2009-06-01 13:40:05 +12:00
Joshua Peek
669fd84910 AS::Concern redefines "include" to lazy include modules as dependencies 2009-05-29 17:03:23 -05:00
Joshua Peek
c7c35be8fe AS::Concern includes InstanceMethods module if it exists 2009-05-29 16:28:54 -05:00
Joshua Peek
69742ca8fa Merge branch 'master' into active_model
Conflicts:
	activemodel/lib/active_model/core.rb
	activemodel/test/cases/state_machine/event_test.rb
	activemodel/test/cases/state_machine/state_transition_test.rb
	activerecord/lib/active_record/validations.rb
	activerecord/test/cases/validations/i18n_validation_test.rb
	activeresource/lib/active_resource.rb
	activeresource/test/abstract_unit.rb
2009-05-29 16:06:21 -05:00
Joshua Peek
4e50a35fa2 Break up DependencyModule's dual function of providing a "depend_on" DSL and "included" block DSL into separate modules. But, unify both approaches under AS::Concern. 2009-05-28 11:35:36 -05:00
Chad Woolley
0f1b283e03 Fix eager association test related to different ordering on sqlite
[#2686 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-05-21 10:01:47 -07:00
Jeremy Kemper
5f222c524e Remove 'core' fluff. Hookable ActiveSupport.load_all! 2009-05-20 18:12:44 -07:00
Emilio Tagua
20deb677a2 Add missing models and fixtures [#2673 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-05-19 12:11:46 +02:00
Jeremy Kemper
ee5520a0a5 Merge branch 'master' of git@github.com:rails/rails 2009-05-18 15:02:15 -07:00
Emilio Tagua
5463823df3 Remove unnecessary condition and local variable [#2602 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-05-18 22:46:37 +02:00
Jeremy Kemper
3e2f0800e3 Merge branch 'master' of git@github.com:rails/rails 2009-05-18 13:43:44 -07:00
Ken Collins
87adecfef5 Reimplement Fixtures.identify so that it consistently generates identities across ruby versions.
[#2633 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2009-05-18 13:40:45 -07:00
Luca Guidi
cef76c8af4 Ensure HasManyThroughAssociation#destroy delete orphan records [#2251 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2009-05-18 22:30:43 +02:00
Jeremy Kemper
a69b28a8b1 Missing 1.8.7 backport extensions 2009-05-18 13:20:04 -07:00