aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | | | Stop passing the column to the connection adapter when quoting defaultsSean Griffin2015-01-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The column is no longer used for anything besides type casting, which is what we're trying to remove from the column entirely.
* | | | | | | | Merge pull request #18271 from arunagw/change-copyright-yearRobin Dupret2015-01-012-2/+2
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Update copyright notices to 2015 [ci skip]
| * | | | | | | | Update copyright notices to 2015 [ci skip]Arun Agrawal2014-12-312-2/+2
| | | | | | | | |
* | | | | | | | | Fix warning: assigned but unused variable - postRyuta Kamizono2014-12-311-1/+1
|/ / / / / / / /
* | | | | | | | Extract the index length validation to a auxiliar methodRafael Mendonça França2014-12-303-9/+12
| | | | | | | |
* | | | | | | | Merge pull request #18264 from yahonda/rename_index_mysqlRafael Mendonça França2014-12-301-0/+3
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Raise a better exception for renaming long indexes for mysql adapters
| * | | | | | | | Raise a better exception for renaming long indexes for mysql adaptersYasuo Honda2014-12-301-0/+3
| | | | | | | | |
* | | | | | | | | Fix error message when trying to create an associated recordRafael Mendonça França2014-12-304-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This error only happens when the foreign key is missing. Before this fix the following exception was being raised: NoMethodError: undefined method `val' for #<Arel::Nodes::BindParam:0x007fc64d19c218> Now the message is: ActiveRecord::UnknownAttributeError: unknown attribute 'foreign_key' for Model.
* | | | | | | | | Share foreign_key_present? implementation in _has_ associationsbrainopia2014-12-316-43/+71
|/ / / / / / / /
* | | | | | | | Merge pull request #17680 from larskanis/fix_bytea_change_detectionSean Griffin2014-12-302-1/+9
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | PostgreSQL, Fix change detection caused by superfluous bytea unescaping
| * | | | | | | | PostgreSQL, Fix change detection caused by wrong data for bytea unescaping.Lars Kanis2014-12-292-1/+9
| | |_|_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This showed up when running BinaryTest#test_load_save with the more restrictive input string handling of pg-0.18.0.pre20141117110243.gem . Bytea values sent to the server are in binary format, but are returned back as escaped text. To fulfill the assumption that type_cast_from_database(type_cast_for_database(binary)) == binary we unescape only, if the value was really received from the server.
* | | | | | | | Update CHANGELOG entry for #18070 [ci skip]Prathamesh Sonpatki2014-12-311-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Improved wording of CHANGELOG entry for https://github.com/arthurnn/rails/commit/5acd24bbeae0e9e5e81e87b5929e17f35527b2ea.
* | | | | | | | Ensures that primary_key method will return nil when multi-pkArthur Neves2014-12-306-8/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When table has a composite primary key, the `primary_key` method for sqlite3 and postgresql was only returning the first field of the key. Ensures that it will return nil instead, as AR dont support composite pks.
* | | | | | | | Tiny documentation fixes [ci skip]Robin Dupret2014-12-301-1/+1
| | | | | | | |
* | | | | | | | AR specific length validator to respect `marked_for_destruction`.Yves Senn2014-12-305-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #7247. Conflicts: activerecord/CHANGELOG.md activerecord/test/models/owner.rb
* | | | | | | | Add doc for `:touch` option of AR::Base#saveclaudiob2014-12-301-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ActiveRecord::Base `save` and `save!` take an option boolean `:touch` parameter since #18225 (stems from #18202). This commit document that parameter. [ci skip]
* | | | | | | | Ensure `first!` and friends work on loaded associationsSean Griffin2014-12-293-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #18237
* | | | | | | | Require Arel 7.0.0.alphaSean Griffin2014-12-291-1/+1
| | | | | | | |
* | | | | | | | Remove all cases of manuallly wrapping `Arel::Nodes::Quoted`Sean Griffin2014-12-297-34/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is no longer required now that we are injecting a type caster object into the Arel table, with the exception of uniqueness validations. Since it calls `ConnectionAdapter#type_cast`, the value has already been cast for the database. We don't want Arel to attempt to cast it further, so we need to continue wrapping it in a quoted node. This can potentially go away when this validator is refactored to make better use of `where` or the predicate builder.
* | | | | | | | Pass a type caster when aliasing tables for joinsSean Griffin2014-12-294-10/+15
| | | | | | | |
* | | | | | | | Fix failing testsSean Griffin2014-12-291-8/+4
| | | | | | | |
* | | | | | | | Extract an explicit type caster classSean Griffin2014-12-298-39/+69
| | | | | | | |
* | | | | | | | Rely on the injectable type caster for `arel_table`Sean Griffin2014-12-296-74/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This API will require much less consuming code to change to accomodate the removal of automatic type casting from Arel. As long as the predicates are constructed using the `arel_table` off of an AR subclass, there will be no changes that need to happen.
* | | | | | | | Merge pull request #18097 from k0kubun/readonly-eager_loadRafael Mendonça França2014-12-293-1/+11
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | `eager_load` preserves readonly flag for associations
| * | | | | | | | `eager_load` preserves readonly flag for associationsTakashi Kokubun2014-12-303-1/+11
| |/ / / / / / /
* / / / / / / / Add nodoc to touch at no_touching.rbRafael Mendonça França2014-12-291-1/+1
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is already docummented at persistence.rb. [ci skip]
* | | | | | | Minor documentation edits [ci skip]Robin Dupret2014-12-281-6/+5
| | | | | | |
* | | | | | | Merge pull request #18209 from claudiob/bump-to-2-2Guillermo Iguaran2014-12-281-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Require Ruby 2.2 for Rails 5.0
| * | | | | | | Require Ruby 2.2 for Rails 5.0claudiob2014-12-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stems from [this comment](https://github.com/rails/rails/pull/18203#issuecomment-68138096) by @robin850 and by the blog post http://weblog.rubyonrails.org/2014/12/19/Rails-4-2-final
* | | | | | | | docs, cleanup Active Record CHANGELOG. [ci skip]Yves Senn2014-12-281-4/+4
| | | | | | | |
* | | | | | | | Fix warning: `*' interpreted as argument prefixRyuta Kamizono2014-12-281-1/+1
| | | | | | | |
* | | | | | | | Provide :touch option to save() to accommodate saving without updating ↵Dan Olson2014-12-275-10/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | timestamps. [#18202]
* | | | | | | | Provide a better error message for unsupported classes in `serialize`Sean Griffin2014-12-273-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We only support classes which provide a no-args constructor to use as a default value. We can provide a more helpful error message if we catch this when `serialize` is called, rather than letting it error when you try to assign the attribute. Fixes #18224
* | | | | | | | Add bigint primary key support for MySQL.Ryuta Kamizono2014-12-285-7/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example: create_table :foos, id: :bigint do |t| end
* | | | | | | | Support for any type primary key.Ryuta Kamizono2014-12-284-10/+35
| | | | | | | |
* | | | | | | | add autoload for `ForeignKeyDefinition`.Yves Senn2014-12-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | /cc @sgrif
* | | | | | | | reduce duplication in `ConnectionAdapters::Table` docs. [ci skip]Yves Senn2014-12-271-27/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of the documentation very closely mirrors the matching docs from `SchemaStatements`. I reduced duplicated copy and added links to the underlying methods for the user to follow.
* | | | | | | | Refactor `PostgreSQL::TableDefinition#primary_key`Ryuta Kamizono2014-12-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because call the `column` method and set the `options[:primary_key]` is handled at `super`, here need only treat the `options[:default]`.
* | | | | | | | Inform Arel we don't need additional type casting in testsSean Griffin2014-12-263-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of the larger refactoring to remove type casting from Arel. We can inform it that we already have the right type by wrapping the value in an `Arel::Nodes::Quoted`. This commit can be reverted when we have removed type casting from Arel in Rail 5.1
* | | | | | | | Inform Arel we don't need additional type casting in batchesSean Griffin2014-12-261-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of the larger refactoring to remove type casting from Arel. We can inform it that we already have the right type by wrapping the value in an `Arel::Nodes::Quoted`. This commit can be reverted when we have removed type casting from Arel in Rail 5.1
* | | | | | | | Inform Arel that we don't need additional type casting in batchingSean Griffin2014-12-261-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of the larger refactoring to remove type casting from Arel. We can inform it that we already have the right type by wrapping the value in an `Arel::Nodes::Quoted`. This commit can be reverted when we have removed type casting from Arel in Rail 5.1
* | | | | | | | Go through normal `update_all` logic when updating lock columnsSean Griffin2014-12-262-19/+7
| | | | | | | |
* | | | | | | | Go through normal `update_all` logic when updating counter cachesSean Griffin2014-12-261-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of a larger refactoring to remove type casting behavior from Arel
* | | | | | | | We don't need additional type casting for locking updatesSean Griffin2014-12-261-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of the larger refactoring to remove type casting from Arel. We can inform it that we already have the right type by wrapping the value in an `Arel::Nodes::Quoted`. This commit can be reverted when we have removed type casting from Arel in Rail 5.1
* | | | | | | | Inform Arel that we don't need type casting in testsSean Griffin2014-12-261-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of the larger refactoring to remove type casting from Arel. We can inform it that we already have the right type by wrapping the value in an `Arel::Nodes::Quoted`. This commit can be reverted when we have removed type casting from Arel in Rail 5.1
* | | | | | | | Go through normal where logic in `apply_join_dependency`Sean Griffin2014-12-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of the larger refactoring to remove type casting from Arel.
* | | | | | | | Inform Arel that we don't need to cast a value in testsSean Griffin2014-12-261-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of the larger refactoring to remove type casting from Arel. We can inform it that we already have the right type by wrapping the value in an `Arel::Nodes::Quoted`. This commit can be reverted when we have removed type casting from Arel in Rail 5.1
* | | | | | | | We don't need to type cast the offset in `find_in_batches`Sean Griffin2014-12-261-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of the larger refactoring to remove type casting from Arel. We can inform it that we already have the right type by wrapping the value in an `Arel::Nodes::Quoted`. This commit can be reverted when we have removed type casting from Arel in Rail 5.1
* | | | | | | | Fall back to type casting from the connection adapterSean Griffin2014-12-261-2/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are several valid cases where right now we can't determine the association's class in a call to `where`. In these cases, we can fall back to casting by looking up the column from the connection adapter (which is what happens right now when we fall through to Arel) This is ugly, and since we're trying to separate the concept of a type from a column, I'd like to remove it in the future. The problem basically comes down to this: Liquid.joins(molecules: :electrons) .where("molecules.name" => "something", "electrons.name" => "something") The hash in this case will turn into: { molecules: { name: "something" }, electrons: { name: "something" }, } What we actually need is: { molecules: { name: "something", electrons: { name: "something" }, } } /cc @mrgilman
* | | | | | | | Go through normal `where` logic in uniqueness validationSean Griffin2014-12-261-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code could use some much heavier refactoring. It looks like `build_relation` duplicates most of the logic of `Relation#where` and `PredicateBuilder` with regards to handling associations and attribute aliases