aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/type.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix doc typo [ci skip]Tom Copeland2017-12-121-1/+1
|
* Move Attribute and AttributeSet to ActiveModelLisa Ugray2017-11-091-0/+4
| | | | | Use these to back the attributes API. Stop automatically including ActiveModel::Dirty in ActiveModel::Attributes, and make it optional.
* [Active Model] require => require_relativeAkira Matsuda2017-10-211-16/+16
| | | | This basically reverts ee5cfc01a5797f854c8441539b0cae326a81b963
* Use frozen string literal in activemodel/Kir Shatrov2017-07-161-0/+2
|
* [Active Model] require => require_relativeAkira Matsuda2017-07-011-14/+14
|
* Remove non-exists method delegation and correct docjasl2017-03-111-9/+1
|
* Merge pull request #26696 from iainbeeston/only-ruby-types-in-activemodelSean Griffin2016-12-081-4/+0
|\ | | | | | | Moved database-specific ActiveModel types into ActiveRecord
| * Moved database-specific ActiveModel types into ActiveRecordIain Beeston2016-10-141-4/+0
| | | | | | | | ie. DecimalWithoutScale, Text and UnsignedInteger
* | Corrected comments referring to ActiveModel::AttributesIain Beeston2016-10-031-1/+1
|/ | | | Should be ActiveRecord::Attributes (ActiveModel::Attributes does not exist)
* applies new string literal convention in activemodel/libXavier Noria2016-08-061-17/+17
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* use same name to type objectyuuji.yaginuma2016-03-091-1/+1
| | | | Follow up to #24079
* Add an immutable string type to opt out of string dupingSean Griffin2015-10-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This type adds an escape hatch to apps for which string duping causes unacceptable memory growth. The reason we are duping them is in order to detect mutation, which was a feature added to 4.2 in #15674. The string type was modified to support this behavior in #15788. Memory growth is really only a concern for string types, as it's the only mutable type where the act of coersion does not create a new object regardless (as we're usually returning an object of a different class). I do feel strongly that if we are going to support detecting mutation, we should do it universally for any type which is mutable. While it is less common and ideomatic to mutate strings than arrays or hashes, there shouldn't be rules or gotchas to understanding our behavior. However, I also appreciate that for apps which are using a lot of string columns, this would increase the number of allocations by a large factor. To ensure that we keep our contract, if you'd like to opt out of mutation detection on strings, you'll also be option out of mutation of those strings. I'm not completely married to the thought that strings coming out of this actually need to be frozen -- and I think the name is correct either way, as the purpose of this is to provide a string type which does not detect mutation. In the new implementation, I'm only overriding `cast_value`. I did not port over the duping in `serialize`. I cannot think of a reason we'd need to dup the string there, and the tests pass without it. Unfortunately that line was introduced at a time where I was not nearly as good about writing my commit messages, so I have no context as to why I added it. Thanks past Sean. You are a jerk.
* Remove no-op options being passed in AM type registrationsSean Griffin2015-09-211-11/+11
| | | | | | The `override` option is only a thing for Active Record registrations. We should figure out how to make this properly error out without doing anything too weird to the code.
* `TypeMap` and `HashLookupTypeMap` shouldn't be in Active ModelSean Griffin2015-09-211-2/+0
| | | | | | These are used by the connection adapters to convert SQL type information into the appropriate type object, and makes no sense outside of the context of Active Record
* Move ActiveRecord::Type to ActiveModelKir Shatrov2015-09-211-0/+59
The first step of bringing typecasting to ActiveModel