Skip to content

Commit

Permalink
Logic around the CMS Preview API is required prior to initialisation (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdavidhamilton authored Oct 26, 2023
1 parent 2680635 commit 714a7ba
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
6 changes: 1 addition & 5 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,7 @@ def dashboard?
#
# @return [Boolean]
def preview?
if defined?(::Types)
Types::Params::Bool[ENV.fetch('CONTENTFUL_PREVIEW', false)]
else
false
end
Dry::Types['params.bool'][ENV.fetch('CONTENTFUL_PREVIEW', false)]
end

# @return [Boolean]
Expand Down
1 change: 0 additions & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
# elsif Rails.application.live?
# config.action_dispatch.cookies_same_site_protection = :strict
# else
# # default
# config.action_dispatch.cookies_same_site_protection = :lax
end

Expand Down
2 changes: 0 additions & 2 deletions config/initializers/contentful_rails.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require_relative 'types'

require 'management'
require 'caching'
require 'pagination'
Expand Down
10 changes: 4 additions & 6 deletions config/initializers/types.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
unless defined?(::Types)
require 'dry-types'
require 'dry-types'

module Types
include Dry.Types()
include Dry::Core::Constants
end
module Types
include Dry.Types()
include Dry::Core::Constants
end

0 comments on commit 714a7ba

Please sign in to comment.