Commit Graph

114 Commits

Author SHA1 Message Date
kennyj
42592b4338 Fix type_to_sql with text and limit on mysql/mysql2. Fix GH #3931. 2012-02-29 01:51:29 +09:00
Santiago Pastorino
434bbb0efc Revert "Merge pull request #2194 from cldwalker/after_initialize"
This reverts commit 198300727d, reversing
changes made to ae65c0b7a4.
2011-07-23 20:49:42 -03:00
Les Fletcher
3dc5f71c17 fix after_initialize edge case (close #2074 and close #2175)
fix behavior when after_initialize is defined and a block is passed to Base.create
2011-07-22 20:14:48 -04:00
Jon Leighton
5c591e5c96 Fix exception if old and new targets are both nil. Fixes #1471.
Conflicts:

	activerecord/test/models/comment.rb
2011-07-12 00:16:44 +01:00
Tomas D'Stefano
15f5c3bcbd Destroy association habtm record before destroying the record itself. Fixes issue #402. 2011-07-08 22:31:50 +01: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
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
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
Christopher Meiklejohn
4fbd8adf48 Don't quote ID's as Arel will quote them -- follow same conventions as the delete method. 2011-05-08 18:37:28 +01:00
Josh Kalderimis
86d7ed3375 singular and collection relations in AR can now specify mass-assignment security options (:as and :without_protection) in build, create and create! methods. 2011-05-01 23:30:07 +02:00
Benjamin Fritsch
714b4a82f4 Added tsvector Datatype Support
Applied Patch from https://rails.lighthouseapp.com/projects/8994/tickets/5577-suport-from-tsvector-data-type-in-postgresql
2011-04-26 09:47:40 +02:00
Aaron Patterson
a0d4c8d1bf using the database adapter to typecast before executing prepared statement 2011-04-14 13:37:39 -07:00
Santiago Pastorino
baa237c974 Allow to read and write AR attributes with non valid identifiers 2011-03-22 20:02:32 -03:00
Jon Leighton
735844db71 Merge branch 'master' into nested_has_many_through
Conflicts:
	activerecord/CHANGELOG
	activerecord/lib/active_record/association_preload.rb
	activerecord/lib/active_record/associations.rb
	activerecord/lib/active_record/associations/class_methods/join_dependency.rb
	activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb
	activerecord/lib/active_record/associations/has_many_association.rb
	activerecord/lib/active_record/associations/has_many_through_association.rb
	activerecord/lib/active_record/associations/has_one_association.rb
	activerecord/lib/active_record/associations/has_one_through_association.rb
	activerecord/lib/active_record/associations/through_association_scope.rb
	activerecord/lib/active_record/reflection.rb
	activerecord/test/cases/associations/has_many_through_associations_test.rb
	activerecord/test/cases/associations/has_one_through_associations_test.rb
	activerecord/test/cases/reflection_test.rb
	activerecord/test/cases/relations_test.rb
	activerecord/test/fixtures/memberships.yml
	activerecord/test/models/categorization.rb
	activerecord/test/models/category.rb
	activerecord/test/models/member.rb
	activerecord/test/models/reference.rb
	activerecord/test/models/tagging.rb
2011-03-04 09:30:27 +00:00
Franck Verrot
8bc464c809 The optimistic lock column should be increased when calling touch
Signed-off-by: Santiago Pastorino and José Ignacio Costa <santiago+jose@wyeworks.com>
2011-02-09 18:27:40 -02:00
Jan
9643243204 make set_table_name take effect immediately 2011-02-08 10:31:09 -08:00
Jon Leighton
52f09eac5b Correctly update counter caches on deletion for has_many :through [#2824 state:resolved]. Also fixed a bunch of other counter cache bugs in the process, as once I fixed this one others started appearing like nobody's business. 2011-02-07 23:35:05 +00:00
Jon Leighton
05bcb8cecc Support the :dependent option on has_many :through associations. For historical and practical reasons, :delete_all is the default deletion strategy employed by association.delete(*records), despite the fact that the default strategy is :nullify for regular has_many. Also, this only works at all if the source reflection is a belongs_to. For other situations, you should directly modify the through association. 2011-02-07 23:35:05 +00:00
Edward Faulkner
909588d964 Fixing ordering of HABTM association deletion [#6191 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-04 19:39:59 -02:00
Jon Leighton
52c47556b7 Add create_association! for belongs_to 2011-01-16 13:43:53 -08:00
Jon Leighton
3c400627eb Support for :counter_cache on polymorphic belongs_to 2010-12-31 20:00:44 +00:00
Szymon Nowak
85683f2a79 Fix creation of has_many through records with custom primary_key option on belongs_to [#2990 state:resolved] 2010-12-23 15:19:17 -08:00
Jon Leighton
834e5336a5 has_many associations with :dependent => :delete_all should update the counter cache when deleting records 2010-12-20 13:56:04 -08:00
Jon Leighton
491ce5b6ce Verify that creating a has_many through record where there is a default_scope on the join model works correctly (creates the join record with the default scope applied) 2010-12-16 01:49:30 +05:30
Jon Leighton
e05162cffa Merge branch 'master' into nested_has_many_through
Conflicts:
	activerecord/lib/active_record/associations.rb
2010-11-08 11:02:26 +00:00
Pratik Naik
c5c2e4fefd Add timestamps to Topic 2010-11-02 01:24:31 +00:00
Jon Leighton
fc276e5635 Merge branch 'master' into nested_has_many_through
Conflicts:
	activerecord/CHANGELOG
	activerecord/lib/active_record/association_preload.rb
	activerecord/lib/active_record/associations.rb
	activerecord/test/schema/schema.rb
2010-10-28 18:06:01 +01:00
Xavier Noria
a031fc57c8 made a pass in AR's schema.rb to keep (most) create statements in lexicographic order, and fixed an FK 2010-10-22 16:55:02 +02:00
Xavier Noria
5b86c3e5bb has_one maintains the association with separate after_create/after_update
This way parent models can get their own after_create and
after_update callbacks fired after has_one has done its job.
2010-10-22 10:28:53 +02:00
Jon Leighton
915ea5ea82 Support the :primary_key option on a through reflection in a nested through association 2010-10-19 16:13:06 +01:00
Jon Leighton
01838636c6 Support for :primary_key option on the source reflection of a through association, where the source is a has_one or has_many 2010-10-19 14:14:06 +01:00
Jon Leighton
596cc3b232 Respect the :primary_key option on the through_reflection of (non-nested) through associations 2010-10-19 12:47:19 +01:00
Jon Leighton
9ec0734874 Properly support conditions on any of the reflections involved in a nested through association 2010-10-19 00:27:40 +01:00
Jon Leighton
002985fb66 Add test_has_one_through_has_one_through_with_belongs_to_source_reflection 2010-10-14 13:44:32 +01:00
Jon Leighton
ab5a933502 Add support for nested through associations in JoinAssociation. Hence Foo.joins(:bar) will work for through associations. There is some duplicated code now, which will be refactored. 2010-10-09 22:00:33 +01:00
Bodaniel Jeanes
b689834bcf Initial nested_has_many_through support [#1152] 2010-09-26 22:25:25 +10:00
Ken Collins
d28438caf2 A few schema changes for the SQL Server adapter.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2010-09-03 14:57:16 +12:00
Neeraj Singh
2e45542942 While creating a new record using has_many create method default scope of child should be respected.
author.posts.create should take into account default_scope
defined on post.

[#3939: state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-19 14:52:15 -03:00
Jeff Lawson
7ce1539934 Bug Fix -- clean up connection after stored procedure [#3151 state:resolved] 2010-08-17 13:15:58 -07:00
Santiago Pastorino
59a0700b56 Both tests are using the same model, move the model to another file and add the missing require 2010-08-14 18:48:06 -03:00
Santiago Pastorino
b451de0d6d Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
Neeraj Singh
6ed1ba472e Ensure we can nest include calls [#5285 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-12 13:10:58 -03:00
Brian Lopez
954de9940b Merge branch 'master' into mysql2
* master:
  Bring returning back to ease migration.
  Remove duplicated logic.
  Eager loading an association should not change the count of children
  fix loading of different elements in array then int and string [#5036 state:resolved]
  Tidy up previous commit.
  test and fix collection_singular_ids= with string primary keys [#5125 state:resolved]
  Handle edge cases in the previous patch.
  Improved how AppGenerator generates the application name. It now detects the current app name whenever possible. This means that renaming the residing directory will not effect the app name generated by AppGenerator.
  ActiveModel::Errors json serialization to work as Rails 3b4 [#5254 state:resolved]
  Add missing require in ActiveSupport::HashWithIndifferentAccess [#5189 state:resolved]
  Add an internal (private API) after_touch callback. [#5271 state:resolved]
  added failing touch propagation test
  Makes rails destroy scaffold don't duplicate routes.draw do |map| |map| when using the deprecated syntax
  Failing test to check for route file corruption if legacy map parameter is used. [#5263 state:open]
  Corrected the rake test:units and test:functionals description [#5251 state:committed]
  Use AS::OrderedHash when trusting in the order of the hash
  Fix label form helper to use I18n and html options, without the need of 'nil' text param:
2010-08-02 13:30:08 -07:00
Neeraj Singh
009aa8825b Eager loading an association should not change the count of children
[#4971 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-02 17:12:59 +02:00
Jakub Kuźma
311ea94f73 added failing touch propagation test
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-08-02 15:56:49 +02:00
Brian Lopez
21e81da335 update tests for mysql2 support 2010-08-02 01:37:57 -07:00
Neeraj Singh
992711a86b update_attribute should not update readonly attributes
[#5106 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-21 14:55:57 +02:00
Neeraj Singh
8bb3b634c0 Timestamp columns of HABTM join table should record timestamps
[#5161 state:resolved]
2010-07-21 14:45:36 +02:00
Neeraj Singh
f576d7cf84 Ensure that primary_keys of HABTM records is not double quoted
[#5152 state:reslved]
2010-07-20 16:45:42 -07:00