updates and spec fixes

This commit is contained in:
2018-06-07 17:31:21 -03:00
parent adc02128e4
commit c2a1c61f82
6 changed files with 144 additions and 142 deletions
@@ -98,7 +98,7 @@ RSpec.describe Api::PostsController, type: :controller do
type: "comment",
attributes: {body: "post-1-comment-1"},
relationships: {
post: {data: {id: post1.id.to_s, type: "posts"}}
post: {data: {id: post1.id.to_s, type: "post"}}
}
}
],
@@ -31,7 +31,7 @@ RSpec.describe Api::PostsController, type: :controller do
type: "comment",
attributes: {body: "post-1-comment-1"},
relationships: {
post: {data: {id: post1.id.to_s, type: "posts"}}
post: {data: {id: post1.id.to_s, type: "post"}}
}
}
]
@@ -1,4 +1,4 @@
class Api::CommentSerializer < ActiveModel::Serializer
attribute :body
belongs_to :post
belongs_to :post, serializer: Api::PostSerializer
end
@@ -1,5 +1,5 @@
class Api::PostSerializer < ActiveModel::Serializer
attribute :title
attribute :body
has_many :comments
has_many :comments, serializer: Api::CommentSerializer
end
@@ -17,8 +17,8 @@ ActiveSupport.to_time_preserves_timezone = true
# Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = true
# Do not halt callback chains when a callback returns false. Previous versions had true.
ActiveSupport.halt_callback_chains_on_return_false = false
## Do not halt callback chains when a callback returns false. Previous versions had true.
#ActiveSupport.halt_callback_chains_on_return_false = false
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
Rails.application.config.ssl_options = { hsts: { subdomains: true } }