aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | Remove references to SQLite3Column from documentationa3gis2014-07-251-1/+1
| | | |
| * | | Fix documentation of SQlite3Adapter.columnsa3gis2014-07-251-1/+1
| | | | | | | | | | | | As of https://github.com/rails/rails/commit/e781aa31fc52a7c696115302ef4d4e02bfd1533b SQLite3Column has been dropped.
* | | | Add support for Postgresql JSONBPhilippe Creux2014-07-244-0/+29
| |/ / |/| | | | | | | | [Philippe Creux, Chris Teague]
* | | fix, mysql `db:purge` respects `Rails.env`.Yves Senn2014-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously this method always established a connection to the test database. This resulted in buggy behavior when combined with other tasks like `bin/rake db:schema:load`. This was one of the reasons why #15394 (22e9a91189af2c4e6217a888e77f22a23d3247d1) was reverted: > I’ve replicated it on a new app by the following commands: 1) rails generate model post:title, 2) rake db:migrate, 3) rake db:schema:load, 4) rails runner ‘puts Post.first’. The last command goes boom. Problem is that rake db:schema:load wipes the database, and then doesn’t actually restore it. This is all on MySQL. There’s no problem with SQLite. -- DHH https://github.com/rails/rails/commit/22e9a91189af2c4e6217a888e77f22a23d3247d1#commitcomment-6834245
* | | Merge pull request #16280 from a3gis/masterMatthew Draper2014-07-241-2/+2
|\| | | | | | | | Fixes #16265 and correct documentation typo
| * | Fix documentation typo in ConnectionSpecification::Resolve.speca3gis2014-07-241-1/+1
| | |
| * | Fixes #16265a3gis2014-07-241-1/+1
| | |
* | | pg, `change_column_default, :table, :column, nil` issues `DROP DEFAULT`.Yves Senn2014-07-241-1/+9
|/ / | | | | | | | | | | | | | | | | | | | | | | Closes #16261. [Matthew Draper, Yves Senn] Using `DEFAULT NULL` results in the same behavior as `DROP DEFAULT`. However, PostgreSQL will cast the default to the columns type, which leaves us with a default like "default NULL::character varying". /cc @matthewd
* | Merge pull request #16231 from Envek/type_in_referencesYves Senn2014-07-222-4/+25
|\ \ | | | | | | | | | | | | | | | * Allow to specify a type for foreign key column in migrations * unified the docs * some cleanup in CHANGELOG
| * | Allow to specify a type for foreign key column in migrationsAndrey Novikov2014-07-222-2/+10
|/ / | | | | | | [Andrey Novikov & Łukasz Sarnacki]
* | Touch option description grammatical error fixed [ci skip]vadivelan2014-07-211-1/+1
| |
* | Merge pull request #16227 from Aguynamedsteve/typo_correctionYves Senn2014-07-191-1/+1
|\ \ | | | | | | Fixed typo in comment [ci skip]
| * | Fixed typo in commentSteve2014-07-191-1/+1
| | |
* | | create_join_table uses same logic as HABTM reflectionsStefan Kanev2014-07-183-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | Before this change, create_join_table would not remove the common prefix in the join table name, unlike ActiveRecord::Reflections. A HABTM between Music::Artist and Music::Record would use a table music_artists_records, while create_join table would create music_artists_music_records.
* | | Merge pull request #15762 from arthurnn/better_error_on_bad_alias_methodMatthew Draper2014-07-181-8/+2
|\ \ \ | | | | | | | | | | | | Dont swallow errors when bad alias_method
| * | | Dont swallow errors when bad alias_methodArthur Neves2014-06-241-8/+2
| | | |
* | | | Prefer if/else for this caseRafael Mendonça França2014-07-171-3/+2
| | | | | | | | | | | | | | | | | | | | One of the branches is using a proc to check if the value respond_to a method so it is better to not do case comparations
* | | | Merge pull request #16188 from marianovalles/fix_rational_to_decimal_type_castRafael Mendonça França2014-07-171-2/+5
|\ \ \ \ | | | | | | | | | | | | | | | Fix rational to decimal on type_cast_from_user
| * | | | Fix decimal_test module and add new test for object responding to to_dMariano Valles2014-07-161-1/+0
| | | | |
| * | | | Fix case statement to use ::Numeric and ::StringMariano Valles2014-07-161-1/+1
| | | | |
| * | | | Change class evaluation for Rationals in cast_valueMariano Valles2014-07-161-4/+6
| | | | |
| * | | | Fix rational to decimal on type_cast_from_userMariano Valles2014-07-161-1/+3
| | | | |
* | | | | Remove need for macro instance vareileencodes2014-07-171-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Same as we did for collection, removed the `@macro` instance var and it is now set in each association. Unfortunately it can't be left undefined in AssociationReflection so it has to be set there. For now I am setting it to NotImplementedError since there is no default macro and it changes based on the reflection type.
* | | | | Remove unused 1:1 association :remote optionChris Griego2014-07-161-1/+1
| | | | | | | | | | | | | | | This option is unused, left over from pre-1.0 Rails to internally distinguish the location of the foreign key.
* | | | | Merge pull request #15944 from seuros/uuidRafael Mendonça França2014-07-161-1/+10
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Treat invalid uuid as nil Conflicts: activerecord/CHANGELOG.md
| * | | | | Treat invalid uuid as nilAbdelkader Boudih2014-07-141-1/+10
| | | | | |
* | | | | | Merge pull request #16183 from goddamnhippie/fix-psych-warningRafael Mendonça França2014-07-161-0/+5
|\ \ \ \ \ \ | | | | | | | | | | | | | | Implement required #encode_with
| * | | | | | Move #encode_with to RelationGustavo Beathyate2014-07-152-4/+5
| | | | | | |
| * | | | | | Implement required #encode_withGustavo Beathyate2014-07-151-0/+4
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While running the spec `ARCONN=mysql2 ruby -v -Itest test/cases/yaml_serialization_test.rb` the following warning shows up: `implementing to_yaml is deprecated, please implement "encode_with"`
* | | | | | Merge pull request #15718 from chancancode/regression_from_15694Godfrey Chan2014-07-161-0/+5
|\ \ \ \ \ \ | | | | | | | | | | | | | | Fixed a regression introduced in 84cf156
| * | | | | | Fixed a regression introduced in 84cf156Godfrey Chan2014-06-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 84cf156 (PR #15694) introduced a subtle regression. There are actually three distinct entry points to creating an AR object – via .new (i.e. #initialize), via #init_with (e.g. from YAML or database queries) and via .allocate. With the patch in 84cf156, attribute methods and respond_to? will not work correctly when objects are allocated directly, without going through either The reason this test case didn't catch the regression was that the `Topic` class is shared between test cases, so by the time this test case is ran the attribute methods are very likely to be defined. Switching to use a fresh anonymous class in the test to ensure we surface this problem in the future.
* | | | | | | nodoc enum hooks [ci skip]Rafael Mendonça França2014-07-161-2/+2
| | | | | | |
* | | | | | | Merge pull request #16138 from sgrif/sg-attribute-set-keyYves Senn2014-07-162-5/+5
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | AttributeSet#include? -> AttributeSet#key?
| * | | | | | | AttributeSet#include? -> AttributeSet#key?Sean Griffin2014-07-112-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/rails/rails/pull/15868/files#r14135210
* | | | | | | | Move uuid_v5 and uuid_v3 to Digest::UUIDRafael Mendonça França2014-07-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These methods are not random so they should not belings to SecureRandom module.
* | | | | | | | Merge pull request #16180 from rafaelfranca/rm-dirtyRafael Mendonça França2014-07-151-2/+2
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Improve Active Model Dirty API.
| * | | | | | | | Deprecate ActiveModel::Dirty#reset_changes in favor of ↵Rafael Mendonça França2014-07-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #clear_changes_information This method name is causing confusion with the `reset_#{attribute}` methods. While `reset_name` set the value of the name attribute for the previous value the `reset_changes` only discard the changes and previous changes.
* | | | | | | | | Merge branch 'master' of git://github.com/rails/railsGodfrey Chan2014-07-153-6/+18
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: activerecord/CHANGELOG.md
| * | | | | | | | Predicate methods don't need to return `true` / `false`Rafael Mendonça França2014-07-151-1/+1
| | | | | | | | |
| * | | | | | | | Fix version detection for RENAME INDEX support. Fixes #15931.Jeff Browning2014-07-153-6/+18
| | | | | | | | |
* | | | | | | | | Merge pull request #16162 from chancancode/fix_json_coderGodfrey Chan2014-07-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed JSON coder when loading NULL from DB
* | | | | | | | | Revert "Revert "Merge pull request #16059 from jenncoop/json-serialized-attr""Godfrey Chan2014-07-153-1/+20
|/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 6f3c64eeb1dc8288dae49f114aaf619adc7dcb7f. Conflicts: activerecord/CHANGELOG.md
* | | | | | | | Merge pull request #15266 from dv/use_counter_cache_for_empty_callGodfrey Chan2014-07-151-0/+8
|\ \ \ \ \ \ \ \ | |_|_|/ / / / / |/| | | | | | | If a counter_cache exists, use it for #empty?
| * | | | | | | If a counter_cache exists, use it for #empty?David Verhasselt2014-06-101-0/+8
| | | | | | | |
* | | | | | | | [CI SKIP] Doc fix.Guo Xiang Tan2014-07-151-2/+2
| | | | | | | |
* | | | | | | | Merge pull request #16089 from ↵Aaron Patterson2014-07-142-67/+128
|\ \ \ \ \ \ \ \ | |_|_|_|/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | eileencodes/refactor-reflections-from-sub-classes-to-delegates Refactor reflections from sub classes to delegates
| * | | | | | | Begin refactoring ThroughReflectioneileencodes2014-07-082-67/+128
| | |/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows us to decouple AssociationReflection and ThroughReflection making ThroughReflection it's own Reflection bucket in a way. The benefit of this is to be able to remove checks against the macro's symbol for exmaple `macro == :belongs_to`. Get all tests passing again Some of the methods that used to be inherited from MacroReflection through AssociationReflection were no longer getting passed through. They needed to be duplicated into the ThroughReflection. I will extract these out into a separate class. Refactor shared methods into strategy object Now that we've separated ThroughReflection and AssociationReflection we can combine shared methods into one class to avoid duplication. Break out class for each type of reflection This creates a class for each reflection type (has_many, has_one, belongs_to and habtm). We then can remove the need to set the macro symbol in each initialization. Tests were updated to reflect these changes because creation of these reflections is now different. Remove need for @collection instance var We now define `collection?` as `false` by default and set it to `true` in `has_and_belongs_to_many` and `has_many` reflections. This removes the need for the `@collection` instance variable. Raise exception on unknown macro types We shouldn't accept just any macro when creating reflections. An unrecongnized AssociationReflection raises an error. Tests in `reflection_test` were updated to reflect these new changes. `:has_and_belongs_to_many` macro tests were removed because we no longer internally return HABTM.
* | | | | | | Merge pull request #16127 from Envek/fix_16111Matthew Draper2014-07-141-1/+2
|\ \ \ \ \ \ \ | |_|_|_|_|/ / |/| | | | | | Dump PostgreSQL primary key with custom function as a default.
| * | | | | | Dump PostgreSQL primary key with custom function as a default.Andrey Novikov2014-07-111-1/+2
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, if use pgcrypto extension in PostgreSQL 9.4 beta 1, where uuid-ossp extension isn't available for moment of writing, and thus to use a gen_random_uuid() method as a primary key default. In this case schema dumper wasn't able to correctly reconstruct create_table statement and lost primary key constraint on schema load. Fixes #16111.
* | | | | | Fixing typo in commentGregory Igelmund2014-07-121-1/+1
| | | | | |