This repository has been archived by the owner on Apr 17, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Serialize Discriminator properties as Strings
Previously, Discriminator properties caused problems for ActiveSupport to_json, as their values are generally DataMapper::Model instances, which implement as_json as an array of all the models of that type. This caused an ActiveSupport::JSON::Encoding::CircularReferenceError. [#1421 state:resolved]
- Loading branch information
Showing
3 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class Vehicle | ||
include DataMapper::Resource | ||
property :id, Serial | ||
property :name, String | ||
property :type, Discriminator | ||
end | ||
|
||
class Car < Vehicle | ||
|
||
end | ||
|
||
class Motorcycle < Vehicle | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters