Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/concerns/view_component/preview_actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module PreviewActions
around_action :set_locale, only: :previews
before_action :require_local!, unless: :show_previews?

content_security_policy(false) if respond_to?(:content_security_policy)
content_security_policy(false)

# Including helpers here ensures that we're loading the
# latest version of helpers if code-reloading is enabled
Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ nav_order: 5

*Stephen Nelson*

* Remove unnecessary `respond_to` checks.

*Tiago Menegaz*, *Joel Hawksley*

* Add Content Harmony & Learn To Be to list of companies using ViewComponent.

*Kane Jamison*
Expand Down
4 changes: 2 additions & 2 deletions lib/view_component/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def initialize(*)
#
# This prevents an exception when rendering a partial inside of a component that has also been rendered outside
# of the component. This is due to the partials compiled template method existing in the parent `view_context`,
# and not the component's `view_context`.
# and not the component's `view_context`.
#
# @private
def render(options = {}, args = {}, &block)
Expand Down Expand Up @@ -287,7 +287,7 @@ def request
#
# @private
def __vc_request
@__vc_request ||= controller.request if controller.respond_to?(:request)
@__vc_request ||= controller.request
end

# The content passed to the component instance as a block.
Expand Down
16 changes: 6 additions & 10 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,14 @@ def with_new_cache
end

def without_template_annotations(&block)
if ActionView::Base.respond_to?(:annotate_rendered_view_with_filenames)
old_value = ActionView::Base.annotate_rendered_view_with_filenames
ActionView::Base.annotate_rendered_view_with_filenames = false
app.reloader.reload! if defined?(app)
old_value = ActionView::Base.annotate_rendered_view_with_filenames
ActionView::Base.annotate_rendered_view_with_filenames = false
app.reloader.reload! if defined?(app)

with_new_cache(&block)
with_new_cache(&block)

ActionView::Base.annotate_rendered_view_with_filenames = old_value
app.reloader.reload! if defined?(app)
else
yield
end
ActionView::Base.annotate_rendered_view_with_filenames = old_value
app.reloader.reload! if defined?(app)
end

def modify_file(file, content)
Expand Down
13 changes: 3 additions & 10 deletions view_component.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,9 @@ Gem::Specification.new do |spec|
spec.homepage = "https://viewcomponent.org"
spec.license = "MIT"

# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
# to allow pushing to a single host or delete this section to allow pushing to any host.
if spec.respond_to?(:metadata)
spec.metadata["allowed_push_host"] = "https://rubygems.org"
spec.metadata["source_code_uri"] = "https://github.com/viewcomponent/view_component"
spec.metadata["changelog_uri"] = "https://github.com/ViewComponent/view_component/blob/main/docs/CHANGELOG.md"
else
raise "RubyGems 2.0 or newer is required to protect against " \
"public gem pushes."
end
spec.metadata["allowed_push_host"] = "https://rubygems.org"
spec.metadata["source_code_uri"] = "https://github.com/viewcomponent/view_component"
spec.metadata["changelog_uri"] = "https://github.com/ViewComponent/view_component/blob/main/docs/CHANGELOG.md"

spec.files = Dir["LICENSE.txt", "README.md", "app/**/*", "docs/CHANGELOG.md", "lib/**/*"]
spec.require_paths = ["lib"]
Expand Down
Loading