Skip to content

Commit

Permalink
Merge pull request #25658 from will-in-wi/fix_rails_5_attributes_docs
Browse files Browse the repository at this point in the history
Update Rails 5 release notes with syntax fixes. [ci skip]
  • Loading branch information
vipulnsward authored and rafaelfranca committed Jul 13, 2016
1 parent 4088840 commit 54f11a9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions guides/source/5_0_release_notes.md
Expand Up @@ -91,6 +91,7 @@ It also changes the behavior of values passed to `ActiveRecord::Base.where`, whi
without having to rely on implementation details or monkey patching.

Some things that you can achieve with this:

* The type detected by Active Record can be overridden.
* A default can also be provided.
* Attributes do not need to be backed by a database column.
Expand Down Expand Up @@ -131,16 +132,16 @@ model.attributes #=> {field_without_db_column: [1, 2, 3]}
**Creating Custom Types:**

You can define your own custom types, as long as they respond
to the methods defined on the value type. The method +deserialize+ or
+cast+ will be called on your type object, with raw input from the
to the methods defined on the value type. The method `deserialize` or
`cast` will be called on your type object, with raw input from the
database or from your controllers. This is useful, for example, when doing custom conversion,
like Money data.

**Querying:**

When `ActiveRecord::Base.where` is called, it will
use the type defined by the model class to convert the value to SQL,
calling +serialize+ on your type object.
calling `serialize` on your type object.

This gives the objects ability to specify, how to convert values when performing SQL queries.

Expand Down

0 comments on commit 54f11a9

Please sign in to comment.