Replace ActionController::Base.helpers.strip_tags(response) · fastruby/allsearch_api@6b26b49 · GitHub
Skip to content

Commit 6b26b49

Browse files
committed
Replace ActionController::Base.helpers.strip_tags(response)
with a custom strip_html_tags method DpulDocument - update field methods to use Array so that we can dafely call .first on them BannerRepository - use Ruby ActiveSupport::JSON to escape < > to the equivelant unicode Application.rb - we dont need BentoRailsApi::Application class without Rails use ActiveRecord.schema_format Make specs to pass related to [pulibrary#514]
1 parent 5334ed7 commit 6b26b49

5 files changed

Lines changed: 27 additions & 31 deletions

File tree

‎app/models/art_museum.rb‎

Lines changed: 5 additions & 1 deletion

‎app/models/dpul_document.rb‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ def service
1919
end
2020

2121
def title
22-
document[:readonly_title_ssim]&.first
22+
Array(document[:readonly_title_ssim]).first
2323
end
2424

2525
def creator
26-
document[:readonly_creator_ssim]&.first
26+
Array(document[:readonly_creator_ssim]).first
2727
end
2828

2929
def publisher
30-
document[:readonly_publisher_ssim]&.first
30+
Array(document[:readonly_publisher_ssim]).first
3131
end
3232

3333
def type

‎app/repositories/banner_repository.rb‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,16 @@ def status_code
4747
end
4848

4949
def as_json
50-
{
51-
text:,
52-
display_banner: display?,
53-
alert_status: status_code,
54-
dismissible:,
55-
autoclear:
56-
}.to_json
50+
require 'active_support/json'
51+
ActiveSupport::JSON.encode(
52+
{
53+
text:,
54+
display_banner: display?,
55+
alert_status: status_code,
56+
dismissible:,
57+
autoclear:
58+
}
59+
)
5760
end
5861
end
5962
end

‎config/application.rb‎

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,14 @@
22

33
require_relative 'boot'
44

5+
require 'active_record'
6+
57
require_relative 'lando_env'
68
require_relative 'db_connection'
79

810
# Require the gems listed in Gemfile, including any gems
911
# you've limited to :test, :development, or :production.
1012
Bundler.require(*CURRENT_ENVIRONMENT.bundler_groups)
1113

12-
module BentoRailsApi
13-
class Application < Rails::Application
14-
# Initialize configuration defaults for originally generated Rails version.
15-
config.load_defaults 8.0
16-
17-
# Use the sql format so that we can capture our postgres custom search configuration
18-
config.active_record.schema_format = :sql
19-
20-
# Configuration for the application, engines, and railties goes here.
21-
#
22-
# These settings can be overridden in specific environments using the files
23-
# in config/environments, which are processed later.
24-
#
25-
# config.time_zone = "Central Time (US & Canada)"
26-
# config.eager_load_paths << Rails.root.join("extras")
27-
end
28-
end
14+
# Use the sql format so that we can capture our postgres custom search configuration
15+
ActiveRecord.schema_format = :sql

‎spec/services/best_bet_loading_service_spec.rb‎

Lines changed: 5 additions & 3 deletions

0 commit comments

Comments
 (0)