Commit Graph

2859 Commits

Author SHA1 Message Date
Aaron Patterson
559d809609 add tests surrounding behavior of save and save! for associations that have validation errors 2011-05-24 11:21:24 -07:00
Aaron Patterson
964338777d adding a test for create! with invalid associations 2011-05-24 11:06:36 -07:00
Aaron Patterson
0df8830160 do not bother with assert_nothing_raised, the test will fail and we get a better trace without it 2011-05-24 11:05:36 -07:00
Joey Butler
e106dbf039 Add failing test case for issue 796 2011-05-24 10:59:37 -07:00
dmathieu
79dc275b8d properly reference yml alias nodes
as per the last version of the yml specifications : http://www.yaml.org/spec/1.2/spec.html#* alias//
2011-05-24 11:18:28 +02:00
Aaron Patterson
5ec23b95ba fixing 1.8 support for new fixture tests 2011-05-23 15:06:13 -07:00
Aaron Patterson
1716da0720 removing CSV fixture support 2011-05-23 15:06:12 -07:00
Aaron Patterson
081b36c6ce fixture file will validate fixture format 2011-05-23 15:06:12 -07:00
Aaron Patterson
5278af3d8e return an empty array for empty yaml files 2011-05-23 15:06:12 -07:00
Aaron Patterson
ad3f0eec75 adding AR::Fixtures::File class to wrap a fixture file 2011-05-23 15:06:12 -07:00
Jon Leighton
d7a910e31e Fix problem with loading polymorphic associations which have been defined in an abstract superclass. Fixes #552. 2011-05-22 21:25:02 +01:00
Santiago Pastorino
da8469fa7d Merge pull request #1187 from thedarkone/polymorphic-class-fix
Handle polymorphic_type NOT NULL columns
2011-05-21 09:43:42 -07:00
Andrew White
09daaaa1e0 Add support for passing mass assignment roles to dynamic finders. Closes #1170. 2011-05-21 16:33:54 +01:00
thedarkone
1c614bcb0f Handle polymorphic_type NOT NULL-able columns as well. 2011-05-21 15:18:09 +02:00
Guillermo Iguaran
23e94a67f8 Refactoring test_has_many_with_pluralize_table_names_false test 2011-05-20 01:53:13 -05:00
Guillermo Iguaran
6a3b3fba5a Allow pluralize_table_names for individual model 2011-05-20 01:44:13 -05:00
Jon Leighton
0afd5850f5 Implement proxy_owner, proxy_target and proxy_reflection methods on CollectionProxy with deprecations. Fixes #1148. 2011-05-19 23:28:44 +01:00
Andrew White
3773aa4fbb Add block setting of attributes to singular associations 2011-05-17 22:16:24 +01:00
Andrew White
42f1ad6865 Pass the attribute and option hashes to build_association
The build_association method was added as an API for plugins
to hook into in 1398db0. This commit restores this API and the
ability to override class.new to return a subclass based on
a virtual attribute in the attributes hash.
2011-05-17 20:43:30 +01:00
Arun Agrawal
ed119aa5d6 Fixed InnerJoinAssociationTest. Need to load essays fixture. 2011-05-17 20:29:28 +05:30
Guillermo Iguaran
2c89ed9ad6 Adding missing require 2011-05-16 22:22:27 -05:00
Jon Leighton
2033ff825b Merge pull request #560 from guilleiguaran/fix_pluralize_table_names_false
Fixing has_many when ActiveRecord::Base.pluralize_table_names is false
2011-05-16 15:40:12 -07:00
Prem Sichanugrist
5ca67eca21 Add ActiveRecord::attribute_names to retrieve a list of attribute names. This method will also return an empty array on an abstract class or a model that the table doesn't exists. 2011-05-15 19:07:40 -04:00
Guillermo Iguaran
ecbde46e57 Fixing has_many association when ActiveRecord::Base.pluralize_table_names is false. fixes #557 2011-05-15 03:53:10 -05:00
Jon Leighton
60b23ea1da CollectionAssociation#merge_target_lists should write to the underlying attributes when copying, rather than using the assignment method 2011-05-14 19:49:22 +01:00
Aaron Patterson
ce1a1b47be supporting infinity and -infinity for timestamps in PG. fixes #544 2011-05-13 13:04:44 -07:00
Jon Leighton
6e466f17c3 Don't use mass-assignment protection when setting foreign keys or association conditions on singular associations. Fixes #481 (again). 2011-05-12 23:29:22 +01:00
Josh Kalderimis
a0000d0ea0 updated AR#create! to accept an options hash so the mass-assignment security role can be passed in, also updated the Changelog to mention the change to some of the AR method signatures. 2011-05-12 09:24:42 +02:00
Jon Leighton
d192d85668 Merge pull request #512 from pivotalneutron/fix_eager_load_with_calculations
Bug fixes for calculations with includes
2011-05-11 13:32:04 -07:00
Fadzril Muhamad & Joseph Palermo
1db49ced45 Bug fixes:
- If doing a count on a relation that has an :include and a :join, it does a distinct even though it should not.
- When doing a count on a relation that has an :include, it always falls back to a old style left join when performing the count.  Looks like it was broken here:
b9599502c9
2011-05-12 04:05:24 +08:00
Santiago Pastorino
c53d3929cd Add missing requires 2011-05-11 13:05:04 -03:00
knapo
bb498a5749 Fix assigning protected attributes by attributes= 2011-05-11 17:17:42 +02:00
Andrew White
0fde84c0f8 Don't remove the target if it has already been destroyed 2011-05-11 14:22:22 +01:00
Michael Ebens
940c31f9de Modified NamedScopeTest to use CollectionAssociation. 2011-05-11 03:37:35 -07:00
Jon Leighton
1dd90f8f12 Don't use select() values from the join model of a through association. Fixes #508. 2011-05-11 08:56:01 +01:00
Jon Leighton
aa1fc1c88c Bring back obj.association_loaded? as a deprecated method. Fixes #472. 2011-05-11 08:56:01 +01:00
Jon Leighton
a8c1fa4afd Add test to specify that attributes from an association's conditions should be assigned without mass-assignment protection when a record is built on the association. 2011-05-10 23:35:15 +01:00
Jon Leighton
9a7dbe2c05 Don't use mass-assignment protection when applying the scoped.scope_for_create. Fixes #481. 2011-05-10 22:54:40 +01:00
Vishnu Atrai
9a0e3d44d1 minor cleaning with new api method 2011-05-11 00:15:16 +05:30
Aaron Patterson
558334a899 deprecating CSV fixture support 2011-05-10 11:08:18 -07:00
Piotr Sarnacki
9f0af6d6dd Merge pull request #495 from vatrai/minor_fixes
minor cleaning
2011-05-10 10:57:15 -07:00
Vishnu Atrai
33f0b6b67d minor cleaning 2011-05-10 22:51:54 +05:30
Joshua Wehner
2cef2d411a Methods that return nil should not be considered YAML 2011-05-10 12:06:09 -04:00
slainer68
95b4989559 Puts ActiveRecord::SessionStore attributes in white list, fixes #483 2011-05-10 16:11:28 +02:00
José Valim
7c353d576a Add failing tests according to #479. 2011-05-10 11:11:30 +02:00
José Valim
b6a2113b8d Add failing tests, according to #480. 2011-05-10 11:02:34 +02:00
José Valim
9e4b715d79 Ensure assign_attributes and update_attributes do not fail on nil, closes #478. 2011-05-10 10:30:27 +02:00
Aaron Patterson
73ff6797ef use a null byte as a bind parameter substitute as it is not allowed in normal SQL. fixes #411, #417 2011-05-09 13:53:57 -07:00
Jon Leighton
72a4893452 Merge pull request #451 from baroquebobcat/fixing_last_for_issue_371 2011-05-08 23:43:34 +01:00
Nick Howard
92c10760d7 Fix for #371
if a query contains a limit or an offset, ActiveRecord::FinderMethods#find_last had inconsistent behavior.

If the records were loaded, it returned the last record in the cached list.
If they were not, it reversed the order of the query and changed the limit to one.
If the earlier limit was less than the total matching the query in the db,
it would return a different record than if the records had been cached.

This commit changes find_last so that it loads the records when getting the
last record on a query containing a limit or an offset, which makes the behavior consistent.
2011-05-08 23:42:53 +01:00