aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/type/string.rb
Commit message (Collapse)AuthorAgeFilesLines
* `type_cast_for_database` -> `serialize`Sean Griffin2015-02-171-1/+1
|
* rm `Type#text?`Sean Griffin2015-02-071-4/+0
| | | | | | | | | | | | | | | | This predicate was only to figure out if it's safe to do case insensitive comparison, which is only a problem on PG. Turns out, PG can just tell us whether we are able to do it or not. If the query turns out to be a problem, let's just replace that method with checking the SQL type for `text` or `character`. I'd rather not burden the type objects with adapter specific knowledge. The *real* solution, is to deprecate this behavior entirely. The only reason we need it is because the `:case_sensitive` option for `validates_uniqueness_of` is documented as "this option is ignored for non-strings". It makes no sense for us to do that. If the type can't be compared in a case insensitive way, the user shouldn't tell us to do case insensitive comparison.
* Correctly ignore `case_sensitive` for UUID uniqueness validationSean Griffin2014-12-261-0/+4
| | | | | | | | I think we should deprecate this behavior and just error if you tell us to do a case insensitive comparison for types which are not case sensitive. Partially reverts 35592307 Fixes #18195
* Revert the behavior of booleans in string columns to that of 4.1Sean Griffin2014-11-091-4/+4
| | | | | | | | | | | | | | | | | | | | | Why are people assigning booleans to string columns? >_> We unintentionally changed the behavior on Sqlite3 and PostgreSQL. Boolean values should cast to the database's representation of true and false. This is 't' and 'f' by default, and "1" and "0" on Mysql. The implementation to make the connection adapter specific behavior is hacky at best, and should be re-visted once we decide how we actually want to separate the concerns related to things that should change based on the database adapter. That said, this isn't something I'd expect to change based on my database adapter. We're storing a string, so the way the database represents a boolean should be irrelevant. It also seems strange for us to give booleans special behavior at all in string columns. Why is `to_s` not sufficient? It's inconsistent and confusing. Perhaps we should consider deprecating in the future. Fixes #17571
* Remove the `text?` predicate from the type objectsSean Griffin2014-07-061-4/+0
| | | | | | | This was only used for uniqueness validations. The first usage was in conjunction with `limit`. Types which cast to string, but are not considered text cannot have a limit. The second case was only with an explicit `:case_sensitive => true` option given by the user.
* active_record: Type cast booleans and durations for string columns.Dylan Thacker-Smith2014-07-061-1/+3
|
* Remove unneccessary special case for money in quotingSean Griffin2014-07-031-4/+4
|
* Detect in-place modifications on StringsSean Griffin2014-06-171-1/+16
|
* Removed unused `klass` definitions from typesSean Griffin2014-06-061-4/+0
| | | | Only `Date` and `Time` are handled.
* Move types to the top level `ActiveRecord` namespaceSean Griffin2014-05-271-0/+27
`ActiveRecord::ConnectionAdapters::Type::Value` => `ActiveRecord::Type::Value`