mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Stub out comments writer when needed
This commit is contained in:
parent
ceded40aa1
commit
e2b7bba626
2
test/fixtures/poro.rb
vendored
2
test/fixtures/poro.rb
vendored
@ -26,8 +26,6 @@ class Profile < Model
|
|||||||
end
|
end
|
||||||
|
|
||||||
class Post < Model
|
class Post < Model
|
||||||
attr_writer :comments
|
|
||||||
|
|
||||||
def comments
|
def comments
|
||||||
@comments ||= [Comment.new(content: 'C1'),
|
@comments ||= [Comment.new(content: 'C1'),
|
||||||
Comment.new(content: 'C2')]
|
Comment.new(content: 'C2')]
|
||||||
|
|||||||
@ -53,6 +53,10 @@ module ActiveModel
|
|||||||
@post1 = Post.new({ title: 'Title 1', body: 'Body 1', date: '1/1/2000' })
|
@post1 = Post.new({ title: 'Title 1', body: 'Body 1', date: '1/1/2000' })
|
||||||
@post2 = Post.new({ title: 'Title 2', body: 'Body 2', date: '1/1/2000' })
|
@post2 = Post.new({ title: 'Title 2', body: 'Body 2', date: '1/1/2000' })
|
||||||
|
|
||||||
|
class << @post2
|
||||||
|
attr_writer :comments
|
||||||
|
end
|
||||||
|
|
||||||
@post2.comments = [
|
@post2.comments = [
|
||||||
Comment.new(content: 'C3'),
|
Comment.new(content: 'C3'),
|
||||||
Comment.new(content: 'C4')
|
Comment.new(content: 'C4')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user