Merge branch 'bf4-consider_association_blocks'

This commit is contained in:
Benjamin Fleischer
2016-01-03 23:16:49 -06:00
4 changed files with 12 additions and 5 deletions

View File

@@ -33,6 +33,7 @@ end
class ProfileSerializer < ActiveModel::Serializer
attributes :name, :description
# TODO: is this used anywhere?
def arguments_passed_in?
instance_options[:my_options] == :accessible
end
@@ -75,6 +76,7 @@ PostSerializer = Class.new(ActiveModel::Serializer) do
Blog.new(id: 999, name: 'Custom blog')
end
# TODO: is this used anywhere?
def custom_options
instance_options
end

View File

@@ -129,7 +129,7 @@ module ActiveModel
class InlineAssociationTestPostSerializer < ActiveModel::Serializer
has_many :comments
has_many :comments, key: :last_comments do
last(1)
object.comments.last(1)
end
end