aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/schema
Commit message (Collapse)AuthorAgeFilesLines
* #7914 get default value when type uses schema nameArturo Pie2012-10-141-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | PostgreSQL adapter properly parses default values when using multiple schemas and domains. When using domains across schemas, PostgresSQL prefixes the type of the default value with the name of the schema where that type (or domain) is. For example, this query: ``` SELECT a.attname, d.adsrc FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = "defaults"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum; ``` could return something like "'<default_value>'::pg_catalog.text" or "(''<default_value>'::pg_catalog.text)::text" for the text columns with defaults. I modified the regexp used to parse this value so that it ignores anything between ':: and \b(?:character varying|bpchar|text), and it allows to have optional parens like in the above second example.
* Merge pull request #7822 from lulalala/reset-counter-cache-for-has-many-throughRafael Mendonça França2012-10-021-0/+1
| | | | | | | Fix reset_counters crashing on has_many :through associations. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/counter_cache.rb
* set the configured #inheritance_column on #become (#7503)Yves Senn2012-09-031-0/+5
| | | | | | | | | | | | | | | | | | | I had to create a new table because I needed an STI table, which does not have both a "type" and a "custom_type" the test fails with: 1) Error: test_alt_becomes_works_with_sti(InheritanceTest): NoMethodError: undefined method `type=' for #<Cabbage id: 1, name: "my cucumber", custom_type: "Cucumber"> /Users/username/Projects/rails/activemodel/lib/active_model/attribute_methods.rb:432:in `method_missing' /Users/username/Projects/rails/activerecord/lib/active_record/attribute_methods.rb:100:in `method_missing' /Users/username/Projects/rails/activerecord/lib/active_record/persistence.rb:165:in `becomes' test/cases/inheritance_test.rb:134:in `test_becomes_works_with_sti' test/cases/inheritance_test.rb:140:in `test_alt_becomes_works_with_sti' Conflicts: activerecord/test/cases/inheritance_test.rb
* Merge pull request #5210 from Pliny/masteriRafael Mendonça França2012-08-211-0/+6
| | | | | | | | Fix for #5200 Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/counter_cache.rb
* Backport #7173.Jeremy Walker2012-08-091-2/+4
|
* Ported PR #4856 to 3-2-stable.Jeremy Walker2012-08-091-1/+2
|
* Merge pull request #6878 from masarakki/masterRafael Mendonça França2012-06-282-0/+19
| | | | | | fix bug in limit of enum columns of mysql Closes #6432
* Postgresql doesn't accept limits on binary (bytea) columns.Victor Costan2012-05-211-0/+1
|
* Test for #5549.Aaron Patterson2012-03-281-0/+1
| | | | | | | | Cherry-picked from e96d04a2e4e244ea5053cb4e8ab97db604d0c796. Conflicts: activerecord/lib/active_record/attribute_methods/read.rb
* Fix type_to_sql with text and limit on mysql/mysql2. Fix GH #3931.kennyj2012-02-292-3/+3
|
* Remove extra attributes from HABTM join tables in AR testsRafael Mendonça França2012-01-261-2/+0
| | | | | | | | | HABTM Join tables should not have extra attributes When extra attributes is needed in HABTM join tables is better to use `has_many :through` association. Fix #4653
* Merge pull request #4487 from sarenji/fix-reset-countersAaron Patterson2012-01-171-0/+10
| | | | Fix bug where reset_counters resets the wrong counter cache.
* serialize fails on subclassAlvaro Bautista2011-12-231-0/+2
|
* Added ActiveRecord::Base.store for declaring simple single-column key/value ↵David Heinemeier Hansson2011-10-131-0/+1
| | | | stores [DHH]
* Only use LOWER for mysql case insensitive uniqueness check when column has a ↵Joseph Palermo2011-10-092-1/+23
| | | | case sensitive collation.
* Raise error when using write_attribute with a non-existent attribute.Jon Leighton2011-09-131-1/+7
| | | | | | | | | Previously we would just silently write the attribute. This can lead to subtle bugs (for example, see the change in AutosaveAssociation where a through association would wrongly gain an attribute. Also, ensuring that we never gain any new attributes after initialization will allow me to reduce our dependence on method_missing.
* Fix exception if old and new targets are both nil. Fixes #1471.Jon Leighton2011-07-121-0/+1
|
* Merge pull request #2017 from Casecommons/active_record_lintJosé Valim2011-07-081-0/+2
|\ | | | | ActiveRecord::Base subclasses should pass ActiveModel::Lint.
| * ActiveRecord::Base should pass ActiveModel::Lint.Grant Hutchins & Peter Jaros2011-07-081-0/+2
| |
* | Destroy association habtm record before destroying the record itself. Fixes ↵Tomas D'Stefano2011-07-081-0/+2
|/ | | | issue #402.
* Merge pull request #560 from guilleiguaran/fix_pluralize_table_names_falseJon Leighton2011-05-161-0/+4
|\ | | | | Fixing has_many when ActiveRecord::Base.pluralize_table_names is false
| * Fixing has_many association when ActiveRecord::Base.pluralize_table_names is ↵Guillermo Iguaran2011-05-151-0/+4
| | | | | | | | false. fixes #557
* | CollectionAssociation#merge_target_lists should write to the underlying ↵Jon Leighton2011-05-141-0/+1
|/ | | | attributes when copying, rather than using the assignment method
* Add test to specify that attributes from an association's conditions should ↵Jon Leighton2011-05-101-0/+1
| | | | be assigned without mass-assignment protection when a record is built on the association.
* Don't quote ID's as Arel will quote them -- follow same conventions as the ↵Christopher Meiklejohn2011-05-081-0/+6
| | | | delete method.
* singular and collection relations in AR can now specify mass-assignment ↵Josh Kalderimis2011-05-011-0/+2
| | | | security options (:as and :without_protection) in build, create and create! methods.
* Added tsvector Datatype SupportBenjamin Fritsch2011-04-261-1/+9
| | | Applied Patch from https://rails.lighthouseapp.com/projects/8994/tickets/5577-suport-from-tsvector-data-type-in-postgresql
* using the database adapter to typecast before executing prepared statementAaron Patterson2011-04-141-0/+1
|
* Allow to read and write AR attributes with non valid identifiersSantiago Pastorino2011-03-221-0/+3
|
* Merge branch 'master' into nested_has_many_throughJon Leighton2011-03-041-0/+28
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * The optimistic lock column should be increased when calling touchFranck Verrot2011-02-091-0/+1
| | | | | | | | Signed-off-by: Santiago Pastorino and José Ignacio Costa <santiago+jose@wyeworks.com>
| * make set_table_name take effect immediatelyJan2011-02-081-0/+4
| |
| * Correctly update counter caches on deletion for has_many :through [#2824 ↵Jon Leighton2011-02-071-0/+4
| | | | | | | | 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.
| * Support the :dependent option on has_many :through associations. For ↵Jon Leighton2011-02-071-0/+1
| | | | | | | | 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.
| * Fixing ordering of HABTM association deletion [#6191 state:resolved]Edward Faulkner2011-02-041-0/+13
| | | | | | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
| * Add create_association! for belongs_toJon Leighton2011-01-161-0/+1
| |
| * Support for :counter_cache on polymorphic belongs_toJon Leighton2010-12-311-0/+1
| |
| * Fix creation of has_many through records with custom primary_key option on ↵Szymon Nowak2010-12-231-0/+1
| | | | | | | | belongs_to [#2990 state:resolved]
| * has_many associations with :dependent => :delete_all should update the ↵Jon Leighton2010-12-201-0/+1
| | | | | | | | counter cache when deleting records
| * Verify that creating a has_many through record where there is a ↵Jon Leighton2010-12-161-0/+1
| | | | | | | | default_scope on the join model works correctly (creates the join record with the default scope applied)
* | Merge branch 'master' into nested_has_many_throughJon Leighton2010-11-081-0/+1
|\| | | | | | | | | Conflicts: activerecord/lib/active_record/associations.rb
| * Add timestamps to TopicPratik Naik2010-11-021-0/+1
| |
* | Merge branch 'master' into nested_has_many_throughJon Leighton2010-10-281-52/+61
|\| | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG activerecord/lib/active_record/association_preload.rb activerecord/lib/active_record/associations.rb activerecord/test/schema/schema.rb
| * made a pass in AR's schema.rb to keep (most) create statements in ↵Xavier Noria2010-10-221-59/+60
| | | | | | | | lexicographic order, and fixed an FK
| * has_one maintains the association with separate after_create/after_updateXavier Noria2010-10-221-0/+8
| | | | | | | | | | This way parent models can get their own after_create and after_update callbacks fired after has_one has done its job.
* | Support the :primary_key option on a through reflection in a nested through ↵Jon Leighton2010-10-191-0/+2
| | | | | | | | association
* | Support for :primary_key option on the source reflection of a through ↵Jon Leighton2010-10-191-2/+3
| | | | | | | | association, where the source is a has_one or has_many
* | Respect the :primary_key option on the through_reflection of (non-nested) ↵Jon Leighton2010-10-191-0/+2
| | | | | | | | through associations
* | Properly support conditions on any of the reflections involved in a nested ↵Jon Leighton2010-10-191-0/+1
| | | | | | | | through association
* | Add test_has_one_through_has_one_through_with_belongs_to_source_reflectionJon Leighton2010-10-141-0/+1
| |