Skip to content

Commit

Permalink
Merge pull request #72 from innoq/rails-7
Browse files Browse the repository at this point in the history
Rails 7.1
  • Loading branch information
mjansing authored Feb 25, 2025
2 parents cc5f286 + 859a92d commit 04d9fbe
Show file tree
Hide file tree
Showing 15 changed files with 331 additions and 52 deletions.
10 changes: 5 additions & 5 deletions app/models/services/similar_terms_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ def self.find_related_and_narrower_concepts(concepts, lang, *terms)
.map(&:label_id)
.first

Iqvoc::XLLabel.base_class.where(:language => lang, :id => label_id).first
Iqvoc::Xllabel.base_class.where(:language => lang, :id => label_id).first
else
Iqvoc::XLLabel.base_class.where('LOWER(value) = ?', term.downcase).first
Iqvoc::Xllabel.base_class.where('LOWER(value) = ?', term.downcase).first
end

results << label.compound_in.map { |ci| ci.concepts.map { |c| c.id } } if label.present?
Expand All @@ -125,9 +125,9 @@ def self.terms_to_labels(lang, *terms)
.where(normal_hash: reduce.call(hashes))
.map(&:label_id)

return Iqvoc::XLLabel.base_class.where(language: lang, id: reduce.call(label_ids))
elsif Iqvoc.const_defined?(:XLLabel)
return Iqvoc::XLLabel.base_class
return Iqvoc::Xllabel.base_class.where(language: lang, id: reduce.call(label_ids))
elsif Iqvoc.const_defined?(:Xllabel)
return Iqvoc::Xllabel.base_class
.where(language: lang)
.where('LOWER(value) IN (?)', terms.map(&:downcase))
else
Expand Down
18 changes: 9 additions & 9 deletions app/views/similar_terms/show.xml.builder
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
xml = Builder::XmlMarkup.new(:indent => 2)
xml.instruct!

xml.OneBoxResults "xmlns:xlink" => "http://www.w3.org/1999/xlink" do
xml.resultCode "success"
xml.totalResults @results.length
xml.urlText t("txt.views.similar_terms.title")
xml.urlLink url_for(request.query_parameters.
merge(:only_path => false, :anchor => ""))
xml.MODULE_RESULT do
xml.title t("txt.views.similar_terms.results_heading",
:terms => params[:terms])
@results.each do |label|
xml.Field label.value, "name" => label.value
xml.urlLink url_for(request.query_parameters.merge(only_path: false, anchor: ""))

if @results.length > 0
xml.MODULE_RESULT do
xml.title t("txt.views.similar_terms.results_heading", terms: params[:terms])
@results.each do |label|
xml.Field label.value, "name" => label.value
end
end
end if @results.length > 0
end
end
2 changes: 1 addition & 1 deletion bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require "fileutils"
APP_ROOT = File.expand_path("..", __dir__)

def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
system(*args, exception: true)
end

FileUtils.chdir APP_ROOT do
Expand Down
7 changes: 6 additions & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
module Iqvoc::SimilarTerms
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0
config.load_defaults 7.1

# Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded.
# Common ones are `templates`, `generators`, or `middleware`, for example.
config.autoload_lib(ignore: %w(assets tasks))

# Configuration for the application, engines, and railties goes here.
#
Expand Down
2 changes: 1 addition & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
if Iqvoc::SimilarTerms.const_defined?(:Application)
Iqvoc::SimilarTerms::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
Iqvoc::Environments.setup_development(config)
Iqvoc::Environments::Development.setup(config)
end
end
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
if Iqvoc::SimilarTerms.const_defined?(:Application)
Iqvoc::SimilarTerms::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
Iqvoc::Environments.setup_production(config)
Iqvoc::Environments::Production.setup(config)
end
end
2 changes: 1 addition & 1 deletion config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
if Iqvoc::SimilarTerms.const_defined?(:Application)
Iqvoc::SimilarTerms::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
Iqvoc::Environments.setup_test(config)
Iqvoc::Environments::Test.setup(config)
end
end
4 changes: 2 additions & 2 deletions config/initializers/content_security_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
# # policy.report_uri "/csp-violation-report-endpoint"
# end
#
# # Generate session nonces for permitted importmap and inline scripts
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
# config.content_security_policy_nonce_directives = %w(script-src)
# config.content_security_policy_nonce_directives = %w(script-src style-src)
#
# # Report violations without enforcing the policy.
# # config.content_security_policy_report_only = true
Expand Down
6 changes: 3 additions & 3 deletions config/initializers/filter_parameter_logging.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Be sure to restart your server when you modify this file.

# Configure parameters to be filtered from the log file. Use this to limit dissemination of
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
# notations and behaviors.
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
# Use this to limit dissemination of sensitive information.
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
]
Loading

0 comments on commit 04d9fbe

Please sign in to comment.