Florian Weber
c6e01f5b60
Fixed that saving a model with multiple habtm associations, would only save the first habtm association.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3331 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-21 15:50:31 +00:00
Scott Barron
88bb279df7
Fix change_column to work with postgres 7.x and 8.x.
...
Closes #3141
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3327 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-20 21:43:47 +00:00
Tobias Lütke
581f12b7b1
removed :piggyback in favor of just allowing :select on :through associations
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3326 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-20 21:26:27 +00:00
Tobias Lütke
90099e9dc2
made .find() and class method delegation work on :through relations
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3325 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-20 21:20:35 +00:00
Tobias Lütke
1d2c6ee8f3
added :piggyback option to has_many :through relationships to pick up values from the join table as needed
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3323 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-20 20:32:47 +00:00
Tobias Lütke
5f06c483ca
Fixed :through relations when using STI inherited classes would use the inherited class's name as foreign key on the join model
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3315 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-16 23:24:58 +00:00
David Heinemeier Hansson
e5d9ad3e29
Added option inheritance for find calls on has_and_belongs_to_many and has_many assosociations [DHH] Added option to specify :group, :limit, :offset, and :select options from find on has_and_belongs_to_many and has_many assosociations [DHH]
...
Added form_remote_for (form_for meets form_remote_tag) [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3287 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-13 00:39:51 +00:00
David Heinemeier Hansson
6427db6baa
Added tests for join models and fixed a bug #3177
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3279 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-11 18:06:51 +00:00
Jeremy Kemper
dc106b932c
Fix some test failures due to MySQL assumptions. Closes #3149 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3254 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-08 23:23:34 +00:00
Jeremy Kemper
d496db1388
Reloading an instance refreshes its aggregations as well as its associations. References #3024 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3242 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-08 04:46:57 +00:00
David Heinemeier Hansson
e466fc45ca
Fixed that using :include together with :conditions array in Base.find would cause NoMethodError ( closes #2887 ) [Paul Hammmond]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3240 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-08 04:44:54 +00:00
Jeremy Kemper
c1537e89f8
PostgreSQL: more robust sequence name discovery. References #3087 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3235 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-08 04:34:26 +00:00
Jeremy Kemper
1dfa0bd372
Don't use transactional fixtures for when DDL changes are involved.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3217 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-04 05:40:50 +00:00
David Heinemeier Hansson
6abda696b5
Added preliminary support for join models [DHH] Added preliminary support for polymorphic associations [DHH] Refactored associations to use reflections to get DRYer, beware, major refactoring -- double check before deploying anything with this (all tests pass, but..)
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3213 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-03 04:29:55 +00:00
David Heinemeier Hansson
57b7532b91
Work-in progress for providing better join model support and polymorphic associations
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3209 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-02 06:03:43 +00:00
Marcel Molina
2e42167058
Allow validate_uniqueness_of to be scoped by more than just one column. Closes #1559 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3206 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-12-02 04:30:46 +00:00
Florian Weber
1f951bbf9f
Made test_update_attributes_after_push_without_duplicate_join_table_rows pass with Oracle Adapter. #2888
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3186 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-24 12:45:33 +00:00
Jeremy Kemper
2b28575734
Reloading a model doesn't lose track of its connection. References #2996 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3182 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-24 07:01:43 +00:00
Florian Weber
c66ac2102b
Fixed bug where using update_attribute after pushing a record to a habtm association of the object caused duplicate rows in the join table. #2888
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3167 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-23 21:03:25 +00:00
Jeremy Kemper
77e0b7986e
Use query methods rather than readers in boolean tests for [3092]. References #2945 . Closes #2949 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3094 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-19 10:00:14 +00:00
Jeremy Kemper
2ed6d365bb
Correct boolean handling in generated reader methods. References #2945 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3092 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-19 09:53:36 +00:00
Jeremy Kemper
b51c3399eb
Don't generate read methods for columns whose names are not valid ruby method names. References #2946 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3089 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-19 06:47:26 +00:00
Jeremy Kemper
9cb02c5317
r3116@asus: jeremy | 2005-11-16 00:17:06 -0800
...
Introducing the Firebird adapter. Closes #1874 .
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3052 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-16 08:18:13 +00:00
Jeremy Kemper
2076dca63f
r3095@asus: jeremy | 2005-11-15 22:40:51 -0800
...
Ticket #1874 - Firebird adapter
r3107@asus: jeremy | 2005-11-16 00:06:14 -0800
quote column aliases
r3108@asus: jeremy | 2005-11-16 00:08:12 -0800
quote columns in construct_conditions_from_arguments. update sequence_name docs. introduce prefetched primary keys.
r3109@asus: jeremy | 2005-11-16 00:09:08 -0800
double-quote rather than single-quote sqlite columns
r3110@asus: jeremy | 2005-11-16 00:09:56 -0800
quote column names and use attribute_condition in validates_uniqueness_of
r3111@asus: jeremy | 2005-11-16 00:12:24 -0800
Use QUOTED_TYPE constant in tests
r3112@asus: jeremy | 2005-11-16 00:13:28 -0800
restrict test_inserts_with_pre_and_suffix to those adapters which support migrations
r3113@asus: jeremy | 2005-11-16 00:14:09 -0800
Use QUOTED_TYPE constant in tests
r3114@asus: jeremy | 2005-11-16 00:14:30 -0800
Use QUOTED_TYPE constant in tests
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3051 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-16 08:16:54 +00:00
Jeremy Kemper
3441dfdb12
Associations handle case-equality more consistently: item.parts.is_a?(Array) and item.parts === Array. Closes #1345 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3043 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-15 10:48:32 +00:00
Jeremy Kemper
fb1efcaf91
SQLServer: insert uses given primary key value if not nil rather than SELECT @@IDENTITY. References #2866 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3035 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-14 22:24:55 +00:00
Jeremy Kemper
d28e9aef5f
Oracle: test case for column default parsing. References #2788 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3019 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-14 04:51:54 +00:00
Jeremy Kemper
54dfb29151
PostgreSQL: min_messages = warning for AR tests.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2989 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-12 22:28:38 +00:00
Jeremy Kemper
7c8f3edc99
r4325@asus: jeremy | 2005-11-12 03:57:46 -0800
...
PostgreSQL: correctly discover custom primary key sequences. PostgreSQL: smarter sequence name defaults, stricter last_insert_id, warn on pk without sequence. Base.reset_sequence_name analogous to reset_table_name (mostly useful for testing). Base.define_attr_method allows nil values. References #2594 .
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2985 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-12 11:59:54 +00:00
Jeremy Kemper
3309268120
Add :group option, correspond to GROUP BY, to the find method and to the has_many association. Closes #2818 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2974 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-10 16:36:01 +00:00
Jeremy Kemper
c91088cd13
Expand tabs and strip trailing whitespace.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2965 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-10 06:24:33 +00:00
Jeremy Kemper
b84a7beb98
acts_as_list plays nicely with inheritance by remembering the class which declared it. Closes #2811 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2964 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-10 06:19:50 +00:00
David Heinemeier Hansson
bc7ec23f4e
Fixed acts_as_list for definitions without an explicit :order #2803 [jonathan@bluewire.net.nz]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2951 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-09 12:50:35 +00:00
Jeremy Kemper
97f418ce02
Correct handling of complex order clauses with SQL Server limit emulation. Closes #2770 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2943 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-08 21:39:13 +00:00
Jeremy Kemper
35b4bdcff0
Destroy associated has_and_belongs_to_many records after all before_destroy callbacks but before destroy. This allows you to act on the habtm association as you please while preserving referential integrity. Closes #2065 .
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2940 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-08 10:19:09 +00:00
Jeremy Kemper
5298f730bb
Add :order option to Author.posts_with_comments_and_categories so that tests which assume implicit id order pass with database which do not provide it. Scrubbed whitespace.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2934 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-08 04:36:37 +00:00
David Heinemeier Hansson
49c801b71d
Added :include as an option for association declarations [DHH]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2898 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-06 20:39:34 +00:00
David Heinemeier Hansson
89ec75edc9
Fixed missing join table fixtures
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2897 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-06 19:25:58 +00:00
David Heinemeier Hansson
c8dd66fdcd
Made association extensions use simpler block syntax
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2895 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-06 19:05:42 +00:00
Jeremy Kemper
a83e0cdec5
r2916@asus: jeremy | 2005-11-06 05:04:06 -0800
...
Rename conditions_scoping_test to method_scoping_test.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2889 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-06 10:19:28 +00:00
Jeremy Kemper
390e6d246c
r2915@asus: jeremy | 2005-11-06 05:02:53 -0800
...
Rename Base.constrain to Base.with_scope so it doesn't conflict with existing concept of database constraints. Make scoping more robust: uniform method => parameters, validated method names and supported finder parameters, raise exception on nested scopes.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2888 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-06 10:18:51 +00:00
David Heinemeier Hansson
a5a82d978b
Added extension capabilities to has_many and has_and_belongs_to_many proxies [DHH] Added find_or_create_by_X as a second type of dynamic finder that'll create the record if it doesn't already exist [DHH] Added constrain scoping for creates using a hash of attributes bound to the :creation key [DHH]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2872 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-04 19:39:50 +00:00
Jeremy Kemper
56ade75131
Explicitly require topic from reply fixture.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2867 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-04 05:46:28 +00:00
Jeremy Kemper
44d1420757
Add Model.create! to match existing model.save! method. When save! raises RecordInvalid, you can catch the exception, retrieve the invalid record (invalid_exception.record), and see its errors (invalid_exception.record.errors).
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2863 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-03 18:54:16 +00:00
David Heinemeier Hansson
8c512a1caf
Added extension capabilities to has_many and has_and_belongs_to_many proxies [DHH]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2861 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-03 09:06:42 +00:00
Jeremy Kemper
aabf9093a0
Correct reader method generation for primary key attribute: handle case when primary_key is defined but its column is nil, such as when the model class is backed by a view.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2850 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-11-02 17:30:59 +00:00
Florian Weber
d5859d0b17
Added that an DuplicateMigrationVersionError gets raised when multiple migrations have the same version number.
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2832 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-10-31 15:43:02 +00:00
David Heinemeier Hansson
c21fdf31a5
Changed :dbfile to :database for SQLite adapter for consistency (old key still works as an alias) ( closes #2644 ) [Dan Peterson]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2825 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-10-30 08:10:04 +00:00
David Heinemeier Hansson
68160b3485
Added migration support for Oracle ( closes #2647 ) [Michael Schoen]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2817 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-10-29 18:40:49 +00:00
David Heinemeier Hansson
e508595cf7
Fixed SQL Server adapter so it honors options[:conditions] when applying :limits ( closes #1978 ) [Tom Ward] Fixed SQL Server adapter to pass even more tests and do even better ( closes #2634 ) [rtomayko@gmail.com]
...
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2781 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
2005-10-28 09:20:05 +00:00