mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Merge 0-10-stable into master (to fix breaking change). (#2023)
* Merge pull request #1990 from mxie/mx-result-typo Fix typos and capitalization in Relationship Links docs [ci skip] * Merge pull request #1992 from ojiry/bump_ruby_versions Run tests by Ruby 2.2.6 and 2.3.3 * Merge pull request #1994 from bf4/promote_architecture Promote important architecture description that answers a lot of questions we get Conflicts: docs/ARCHITECTURE.md * Merge pull request #1999 from bf4/typos Fix typos [ci skip] * Merge pull request #2000 from berfarah/patch-1 Link to 0.10.3 tag instead of `master` branch * Merge pull request #2007 from bf4/check_ci Test was failing due to change in JSON exception message when parsing empty string * Swap out KeyTransform for CaseTransform (#1993) * delete KeyTransform, use CaseTransform * added changelog Conflicts: CHANGELOG.md * Merge pull request #2005 from kofronpi/support-ruby-2.4 Update jsonapi runtime dependency to 0.1.1.beta6 * Bump to v0.10.4 * Merge pull request #2018 from rails-api/bump_version Bump to v0.10.4 [ci skip] Conflicts: CHANGELOG.md * Merge pull request #2019 from bf4/fix_method_redefined_warning Fix AMS warnings * Merge pull request #2020 from bf4/silence_grape_warnings Silence Grape warnings * Merge pull request #2017 from bf4/remove_warnings Fix mt6 assert_nil warnings * Updated isolated tests to assert correct behavior. (#2010) * Updated isolated tests to assert correct behavior. * Added check to get unsafe params if rails version is great than 5 * Merge pull request #2012 from bf4/cleanup_isolated_jsonapi_renderer_tests_a_bit Cleanup assertions in isolated jsonapi renderer tests a bit * Add Model#attributes helper; make test attributes explicit * Fix model attributes accessors * Fix typos * Randomize testing of compatibility layer against regressions * Test bugfix * Add CHANGELOG * Merge pull request #1981 from groyoh/link_doc Fix relationship links doc Conflicts: CHANGELOG.md
This commit is contained in:
committed by
GitHub
parent
2a6d373cb2
commit
93ca27fe44
19
test/fixtures/poro.rb
vendored
19
test/fixtures/poro.rb
vendored
@@ -1,10 +1,7 @@
|
||||
class Model < ActiveModelSerializers::Model
|
||||
FILE_DIGEST = Digest::MD5.hexdigest(File.open(__FILE__).read)
|
||||
rand(2).zero? && derive_attributes_from_names_and_fix_accessors
|
||||
|
||||
# Defaults to the downcased model name.
|
||||
def id
|
||||
@id ||= self.class.model_name.name.downcase
|
||||
end
|
||||
attr_writer :id
|
||||
|
||||
# At this time, just for organization of intent
|
||||
class_attribute :association_names
|
||||
@@ -23,6 +20,10 @@ class Model < ActiveModelSerializers::Model
|
||||
result[association_name] = public_send(association_name).freeze
|
||||
end.with_indifferent_access.freeze
|
||||
end
|
||||
|
||||
def attributes
|
||||
super.except(*association_names)
|
||||
end
|
||||
end
|
||||
|
||||
# see
|
||||
@@ -107,10 +108,6 @@ class PostPreviewSerializer < ActiveModel::Serializer
|
||||
has_many :comments, serializer: ::CommentPreviewSerializer
|
||||
belongs_to :author, serializer: ::AuthorPreviewSerializer
|
||||
end
|
||||
class PostWithTagsSerializer < ActiveModel::Serializer
|
||||
attributes :id
|
||||
has_many :tags
|
||||
end
|
||||
class PostWithCustomKeysSerializer < ActiveModel::Serializer
|
||||
attributes :id
|
||||
has_many :comments, key: :reviews
|
||||
@@ -207,10 +204,6 @@ module Spam
|
||||
end
|
||||
end
|
||||
|
||||
class Tag < Model
|
||||
attributes :name
|
||||
end
|
||||
|
||||
class VirtualValue < Model; end
|
||||
class VirtualValueSerializer < ActiveModel::Serializer
|
||||
attributes :id
|
||||
|
||||
Reference in New Issue
Block a user