From d6fafdedf3bed1b396f04c00217c495a79c39b8f Mon Sep 17 00:00:00 2001 From: Constantine Nikolaou Date: Sat, 20 Mar 2021 18:46:59 +0100 Subject: [PATCH 1/2] Upgrade to rails 6.1.x Fix broken syntax and tests --- Gemfile | 6 +- Gemfile.lock | 346 +++++++++++++++-------------- app/helpers/layout_helper.rb | 2 +- app/mailers/job_mailer.rb | 2 +- app/models/invitation.rb | 2 +- app/validators/email_validator.rb | 2 +- app/validators/salary_validator.rb | 2 +- 7 files changed, 192 insertions(+), 170 deletions(-) diff --git a/Gemfile b/Gemfile index e8d629b..6b56bd1 100644 --- a/Gemfile +++ b/Gemfile @@ -36,12 +36,12 @@ gem 'paperclip', '~> 5.2.0' gem 'pg' gem 'pgcli-rails' gem 'puma' -gem 'rails', '~> 5.2.4.2' +gem 'rails', '>= 5.2.4.5' gem 'rspec-core' gem 'rspec-rails', '~> 3.9' gem 'rswag' gem 'redis-namespace' -gem 'sass-rails', '~> 5.0' +gem 'sass-rails', '>= 5.0' gem 'secure_headers', '~> 3.9' gem 'sidekiq', '>= 5.2.0' gem 'simplecov', '0.16.1' @@ -76,7 +76,7 @@ group :development do gem 'sitemap_generator' gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' - gem 'xray-rails', '>= 0.1.18' + gem 'xray-rails' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 4c09829..bb1bde2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,83 +3,100 @@ GEM specs: aasm (5.1.1) concurrent-ruby (~> 1.0) - actioncable (5.2.4.4) - actionpack (= 5.2.4.4) + actioncable (6.1.3) + actionpack (= 6.1.3) + activesupport (= 6.1.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.4.4) - actionpack (= 5.2.4.4) - actionview (= 5.2.4.4) - activejob (= 5.2.4.4) + actionmailbox (6.1.3) + actionpack (= 6.1.3) + activejob (= 6.1.3) + activerecord (= 6.1.3) + activestorage (= 6.1.3) + activesupport (= 6.1.3) + mail (>= 2.7.1) + actionmailer (6.1.3) + actionpack (= 6.1.3) + actionview (= 6.1.3) + activejob (= 6.1.3) + activesupport (= 6.1.3) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.4.4) - actionview (= 5.2.4.4) - activesupport (= 5.2.4.4) - rack (~> 2.0, >= 2.0.8) + actionpack (6.1.3) + actionview (= 6.1.3) + activesupport (= 6.1.3) + rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.4.4) - activesupport (= 5.2.4.4) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.1.3) + actionpack (= 6.1.3) + activerecord (= 6.1.3) + activestorage (= 6.1.3) + activesupport (= 6.1.3) + nokogiri (>= 1.8.5) + actionview (6.1.3) + activesupport (= 6.1.3) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - active_type (1.4.2) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + active_type (1.6.0) activerecord (>= 3.2) - activejob (5.2.4.4) - activesupport (= 5.2.4.4) + activejob (6.1.3) + activesupport (= 6.1.3) globalid (>= 0.3.6) - activemodel (5.2.4.4) - activesupport (= 5.2.4.4) + activemodel (6.1.3) + activesupport (= 6.1.3) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (5.2.4.4) - activemodel (= 5.2.4.4) - activesupport (= 5.2.4.4) - arel (>= 9.0) - activerecord-session_store (1.1.3) - actionpack (>= 4.0) - activerecord (>= 4.0) + activerecord (6.1.3) + activemodel (= 6.1.3) + activesupport (= 6.1.3) + activerecord-session_store (2.0.0) + actionpack (>= 5.2.4.1) + activerecord (>= 5.2.4.1) multi_json (~> 1.11, >= 1.11.2) - rack (>= 1.5.2, < 3) - railties (>= 4.0) - activestorage (5.2.4.4) - actionpack (= 5.2.4.4) - activerecord (= 5.2.4.4) + rack (>= 2.0.8, < 3) + railties (>= 5.2.4.1) + activestorage (6.1.3) + actionpack (= 6.1.3) + activejob (= 6.1.3) + activerecord (= 6.1.3) + activesupport (= 6.1.3) marcel (~> 0.3.1) - activesupport (5.2.4.4) + mimemagic (~> 0.3.2) + activesupport (6.1.3) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) annotate (3.1.1) activerecord (>= 3.2, < 7.0) rake (>= 10.4, < 14.0) api-pagination (4.8.2) - arel (9.0.0) - ast (2.4.1) - autoprefixer-rails (10.0.0.2) + ast (2.4.2) + autoprefixer-rails (10.2.4.0) execjs - awesome_print (1.8.0) + awesome_print (1.9.2) bcrypt (3.1.16) - better_errors (2.8.1) + better_errors (2.9.1) coderay (>= 1.0.0) erubi (>= 1.0.0) rack (>= 0.9.0) - binding_of_caller (0.8.0) + binding_of_caller (1.0.0) debug_inspector (>= 0.0.1) bootscale (0.7.0) bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) sassc (>= 2.0.0) bootstrap_form (2.7.0) - brakeman (4.9.1) + brakeman (5.0.0) buffer (0.1.3) addressable environs @@ -90,16 +107,16 @@ GEM rake yajl-ruby builder (3.2.4) - bundler-audit (0.7.0.1) + bundler-audit (0.8.0) bundler (>= 1.2.0, < 3) - thor (>= 0.18, < 2) - capybara (3.33.0) + thor (~> 1.0) + capybara (3.35.3) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) - regexp_parser (~> 1.5) + regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) childprocess (3.0.0) chronic (0.10.2) @@ -114,8 +131,8 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.7) - config (2.2.1) + concurrent-ruby (1.1.8) + config (3.0.0) deep_merge (~> 1.2, >= 1.2.1) dry-validation (~> 1.0, >= 1.0.0) connection_pool (2.2.3) @@ -123,12 +140,17 @@ GEM i18n_data (~> 0.10.0) sixarm_ruby_unaccent (~> 1.1) unicode_utils (~> 1.4) - country_select (4.0.0) + country_select (5.0.1) countries (~> 3.0) - sort_alphabetical (~> 1.0) + sort_alphabetical (~> 1.1) crass (1.0.6) - database_cleaner (1.8.5) - debug_inspector (0.0.3) + database_cleaner (2.0.1) + database_cleaner-active_record (~> 2.0.0) + database_cleaner-active_record (2.0.0) + activerecord (>= 5.a) + database_cleaner-core (~> 2.0.0) + database_cleaner-core (2.0.1) + debug_inspector (1.0.0) deep_merge (1.2.1) devise (4.7.3) bcrypt (~> 3.0) @@ -137,7 +159,7 @@ GEM responders warden (~> 1.2.3) diff-lcs (1.4.4) - docile (1.3.2) + docile (1.3.5) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) dotenv (2.7.6) @@ -150,49 +172,45 @@ GEM activemodel-serializers-xml (>= 1.0) activesupport (>= 5.0) request_store (>= 1.0) - dry-configurable (0.11.6) + dry-configurable (0.12.1) concurrent-ruby (~> 1.0) - dry-core (~> 0.4, >= 0.4.7) - dry-equalizer (~> 0.2) + dry-core (~> 0.5, >= 0.5.0) dry-container (0.7.2) concurrent-ruby (~> 1.0) dry-configurable (~> 0.1, >= 0.1.3) - dry-core (0.4.9) + dry-core (0.5.0) concurrent-ruby (~> 1.0) dry-equalizer (0.3.0) dry-inflector (0.2.0) - dry-initializer (3.0.3) - dry-logic (1.0.7) + dry-initializer (3.0.4) + dry-logic (1.1.0) concurrent-ruby (~> 1.0) - dry-core (~> 0.2) - dry-equalizer (~> 0.2) - dry-schema (1.5.4) + dry-core (~> 0.5, >= 0.5) + dry-schema (1.6.1) concurrent-ruby (~> 1.0) dry-configurable (~> 0.8, >= 0.8.3) - dry-core (~> 0.4) - dry-equalizer (~> 0.2) + dry-core (~> 0.5, >= 0.5) dry-initializer (~> 3.0) dry-logic (~> 1.0) - dry-types (~> 1.4) - dry-types (1.4.0) + dry-types (~> 1.5) + dry-types (1.5.1) concurrent-ruby (~> 1.0) dry-container (~> 0.3) - dry-core (~> 0.4, >= 0.4.4) - dry-equalizer (~> 0.3) + dry-core (~> 0.5, >= 0.5) dry-inflector (~> 0.1, >= 0.1.2) dry-logic (~> 1.0, >= 1.0.2) - dry-validation (1.5.6) + dry-validation (1.6.0) concurrent-ruby (~> 1.0) dry-container (~> 0.7, >= 0.7.1) dry-core (~> 0.4) dry-equalizer (~> 0.2) dry-initializer (~> 3.0) dry-schema (~> 1.5, >= 1.5.2) - em-websocket (0.5.1) + em-websocket (0.5.2) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) environs (1.1.0) - erubi (1.9.0) + erubi (1.10.0) erubis (2.7.0) eventmachine (1.2.7) exception_notification (4.4.3) @@ -204,17 +222,20 @@ GEM factory_bot_rails (6.1.0) factory_bot (~> 6.1.0) railties (>= 5.0.0) - faker (2.14.0) + faker (2.16.0) i18n (>= 1.6, < 2) - faraday (1.0.1) + faraday (1.3.0) + faraday-net_http (~> 1.0) multipart-post (>= 1.2, < 3) + ruby2_keywords + faraday-net_http (1.0.1) faraday_middleware (1.0.0) faraday (~> 1.0) fast_jsonapi (1.5) activesupport (>= 4.2) - ffi (1.13.1) - font-awesome-rails (4.7.0.5) - railties (>= 3.2, < 6.1) + ffi (1.15.0) + font-awesome-rails (4.7.0.7) + railties (>= 3.2, < 7) formatador (0.2.5) friendly_id (5.1.0) activerecord (>= 4.0.0) @@ -254,7 +275,7 @@ GEM httparty (0.18.1) mime-types (~> 3.0) multi_xml (>= 0.5.2) - i18n (1.8.5) + i18n (1.8.9) concurrent-ruby (~> 1.0) i18n_data (0.10.0) iniparse (1.5.0) @@ -262,7 +283,7 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (2.3.1) + json (2.5.1) json-schema (2.8.1) addressable (>= 2.4) jwt (2.2.2) @@ -287,11 +308,11 @@ GEM actionmailer (>= 3.2) letter_opener (~> 1.0) railties (>= 3.2) - libv8 (8.4.255.0) + libv8 (8.4.255.0-x86_64-darwin-19) listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - loofah (2.7.0) + loofah (2.9.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) lumberjack (1.2.8) @@ -301,28 +322,28 @@ GEM rest-client (~> 2.0.2) marcel (0.3.3) mimemagic (~> 0.3.2) - marco-polo (1.2.1) - meta-tags (2.13.0) - actionpack (>= 3.2.0, < 6.1) + marco-polo (2.0.1) + railties (>= 6) + meta-tags (2.14.0) + actionpack (>= 3.2.0, < 6.2) method_source (1.0.0) mime-types (3.3.1) mime-types-data (~> 3.2015) - mime-types-data (3.2020.0512) + mime-types-data (3.2021.0225) mimemagic (0.3.5) mini_mime (1.0.2) - mini_portile2 (2.4.0) mini_racer (0.3.1) libv8 (~> 8.4.255) - minitest (5.14.2) + minitest (5.14.4) multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.1.1) nenv (0.3.0) nested_form (0.3.2) netrc (0.11.0) - nio4r (2.5.4) - nokogiri (1.10.10) - mini_portile2 (~> 2.4.0) + nio4r (2.5.7) + nokogiri (1.11.1-x86_64-darwin) + racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) @@ -341,7 +362,7 @@ GEM omniauth-slack (2.3.0) omniauth-oauth2 (~> 1.3.1) orm_adapter (0.5.0) - overcommit (0.55.0) + overcommit (0.57.0) childprocess (>= 0.6.3, < 5) iniparse (~> 1.4) paperclip (5.2.1) @@ -350,42 +371,45 @@ GEM cocaine (~> 0.5.5) mime-types mimemagic (~> 0.3.0) - parallel (1.19.2) - paranoia (2.4.2) - activerecord (>= 4.0, < 6.1) - parser (2.7.1.4) + parallel (1.20.1) + paranoia (2.4.3) + activerecord (>= 4.0, < 6.2) + parser (3.0.0.0) ast (~> 2.4.1) pg (1.2.3) - pgcli-rails (0.5.0) + pgcli-rails (0.5.2) railties (>= 4.2.0) - postmark (1.21.2) + postmark (1.21.3) json postmark-rails (0.20.0) actionmailer (>= 3.0.0) postmark (~> 1.15) - pry (0.13.1) + pry (0.14.0) coderay (~> 1.1) method_source (~> 1.0) public_suffix (4.0.6) - puma (5.0.0) + puma (5.2.2) nio4r (~> 2.0) + racc (1.5.2) rack (2.2.3) rack-livereload (0.3.17) rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.4.4) - actioncable (= 5.2.4.4) - actionmailer (= 5.2.4.4) - actionpack (= 5.2.4.4) - actionview (= 5.2.4.4) - activejob (= 5.2.4.4) - activemodel (= 5.2.4.4) - activerecord (= 5.2.4.4) - activestorage (= 5.2.4.4) - activesupport (= 5.2.4.4) - bundler (>= 1.3.0) - railties (= 5.2.4.4) + rails (6.1.3) + actioncable (= 6.1.3) + actionmailbox (= 6.1.3) + actionmailer (= 6.1.3) + actionpack (= 6.1.3) + actiontext (= 6.1.3) + actionview (= 6.1.3) + activejob (= 6.1.3) + activemodel (= 6.1.3) + activerecord (= 6.1.3) + activestorage (= 6.1.3) + activesupport (= 6.1.3) + bundler (>= 1.15.0) + railties (= 6.1.3) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -396,22 +420,22 @@ GEM nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - railties (5.2.4.4) - actionpack (= 5.2.4.4) - activesupport (= 5.2.4.4) + railties (6.1.3) + actionpack (= 6.1.3) + activesupport (= 6.1.3) method_source rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) + thor (~> 1.0) rainbow (3.0.0) raindrops (0.19.1) - rake (13.0.1) + rake (13.0.3) rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) - redis (4.2.2) - redis-namespace (1.8.0) + redis (4.2.5) + redis-namespace (1.8.1) redis (>= 3.0.4) - regexp_parser (1.8.0) + regexp_parser (2.1.1) request_store (1.5.0) rack (>= 1.4) responders (3.0.1) @@ -426,9 +450,9 @@ GEM rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) rspec-mocks (~> 3.9.0) - rspec-core (3.9.2) + rspec-core (3.9.3) rspec-support (~> 3.9.3) - rspec-expectations (3.9.2) + rspec-expectations (3.9.4) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-mocks (3.9.1) @@ -442,55 +466,53 @@ GEM rspec-expectations (~> 3.9.0) rspec-mocks (~> 3.9.0) rspec-support (~> 3.9.0) - rspec-support (3.9.3) - rswag (2.3.1) - rswag-api (= 2.3.1) - rswag-specs (= 2.3.1) - rswag-ui (= 2.3.1) - rswag-api (2.3.1) + rspec-support (3.9.4) + rswag (2.4.0) + rswag-api (= 2.4.0) + rswag-specs (= 2.4.0) + rswag-ui (= 2.4.0) + rswag-api (2.4.0) railties (>= 3.1, < 7.0) - rswag-specs (2.3.1) + rswag-specs (2.4.0) activesupport (>= 3.1, < 7.0) json-schema (~> 2.2) railties (>= 3.1, < 7.0) - rswag-ui (2.3.1) + rswag-ui (2.4.0) actionpack (>= 3.1, < 7.0) railties (>= 3.1, < 7.0) - rubocop (0.91.1) + rubocop (1.11.0) parallel (~> 1.10) - parser (>= 2.7.1.1) + parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.7) + regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 0.4.0, < 1.0) + rubocop-ast (>= 1.2.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (0.4.2) - parser (>= 2.7.1.4) - ruby-progressbar (1.10.1) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.4.1) + parser (>= 2.7.1.5) + ruby-progressbar (1.11.0) + ruby2_keywords (0.0.4) rubyzip (2.3.0) - sass (3.7.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.1.0) - railties (>= 5.2.0) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) sassc (2.4.0) ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt secure_headers (3.9.0) useragent selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) shellany (0.0.1) - shoulda-matchers (4.4.1) + shoulda-matchers (4.5.1) activesupport (>= 4.2.0) - sidekiq (6.1.2) + sidekiq (6.1.3) connection_pool (>= 2.2.2) rack (~> 2.0) redis (>= 4.2.0) @@ -509,26 +531,25 @@ GEM spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) - sprockets (3.7.2) + sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.2) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - thor (1.0.1) - thread_safe (0.3.6) + thor (1.1.0) tilt (2.0.10) - tinymce-rails (5.4.1) + tinymce-rails (5.6.2.1) railties (>= 3.1.1) - tzinfo (1.2.7) - thread_safe (~> 0.1) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) unf (0.1.4) unf_ext unf_ext (0.0.7.7) - unicode-display_width (1.7.0) + unicode-display_width (2.0.0) unicode_utils (1.4.0) - unicorn (5.7.0) + unicorn (5.8.0) kgio (~> 2.6) raindrops (~> 0.7) unicorn-worker-killer (0.4.4) @@ -547,9 +568,10 @@ GEM xray-rails (0.3.2) rails (>= 3.1.0) yajl-ruby (1.4.1) + zeitwerk (2.4.2) PLATFORMS - ruby + x86_64-darwin-19 DEPENDENCIES aasm @@ -611,7 +633,7 @@ DEPENDENCIES postmark-rails puma rack-livereload - rails (~> 5.2.4.2) + rails (>= 5.2.4.5) rails-controller-testing rb-fsevent redis-namespace @@ -619,7 +641,7 @@ DEPENDENCIES rspec-rails (~> 3.9) rswag rubocop - sass-rails (~> 5.0) + sass-rails (>= 5.0) secure_headers (~> 3.9) selenium-webdriver shoulda-matchers @@ -633,7 +655,7 @@ DEPENDENCIES unicorn unicorn-worker-killer whenever - xray-rails (>= 0.1.18) + xray-rails BUNDLED WITH - 2.1.2 + 2.2.14 diff --git a/app/helpers/layout_helper.rb b/app/helpers/layout_helper.rb index 9d281a5..0cc91f6 100644 --- a/app/helpers/layout_helper.rb +++ b/app/helpers/layout_helper.rb @@ -11,7 +11,7 @@ module LayoutHelper # def parent_layout(layout) @view_flow.set(:layout, output_buffer) - output = render(:file => "layouts/#{layout}") + output = render(:file => Rails.root.join("app/views/layouts/#{layout}.html.erb")) self.output_buffer = ActionView::OutputBuffer.new(output) end end diff --git a/app/mailers/job_mailer.rb b/app/mailers/job_mailer.rb index 9d12bd8..21c86c0 100644 --- a/app/mailers/job_mailer.rb +++ b/app/mailers/job_mailer.rb @@ -1,5 +1,5 @@ class JobMailer < ApplicationMailer - add_template_helper(JobsHelper) + helper(JobsHelper) def new_job(job_id) @job = Job.find(job_id).decorate diff --git a/app/models/invitation.rb b/app/models/invitation.rb index 26a749a..56add26 100644 --- a/app/models/invitation.rb +++ b/app/models/invitation.rb @@ -25,7 +25,7 @@ class CodeOfConductValidator < ActiveModel::Validator def validate(record) if record.code_of_conduct == false - record.errors[:base] << "Please accept our Code of Conduct to proceed" + record.errors.add(:base, "Please accept our Code of Conduct to proceed") end end end diff --git a/app/validators/email_validator.rb b/app/validators/email_validator.rb index 4be8266..1d74f30 100644 --- a/app/validators/email_validator.rb +++ b/app/validators/email_validator.rb @@ -1,6 +1,6 @@ class EmailValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) - record.errors[attribute] << (options[:message] || "must be a valid email address") unless email_valid?(value) + record.errors.add(attribute.to_sym, (options[:message] || "must be a valid email address")) unless email_valid?(value) end def email_valid?(email_address) diff --git a/app/validators/salary_validator.rb b/app/validators/salary_validator.rb index 01b0cd7..dcb9cc3 100644 --- a/app/validators/salary_validator.rb +++ b/app/validators/salary_validator.rb @@ -1,6 +1,6 @@ class SalaryValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) - record.errors[attribute] << (options[:message] || "cannot be less than starting salary") unless valid_salary_fields?(record) + record.errors.add(attribute.to_sym, (options[:message] || "cannot be less than starting salary")) unless valid_salary_fields?(record) end def valid_salary_fields?(record) From 63328215337202694e5d2f431bb0e0899bade0d5 Mon Sep 17 00:00:00 2001 From: Constantine Nikolaou Date: Sat, 20 Mar 2021 20:40:59 +0100 Subject: [PATCH 2/2] Update layout to unified template instead of nested --- app/helpers/layout_helper.rb | 3 +- app/views/home/index.html.erb | 6 +- app/views/layouts/application.html.erb | 131 ++++++++++++++----------- app/views/layouts/base.html.erb | 77 ++++++++++----- 4 files changed, 129 insertions(+), 88 deletions(-) diff --git a/app/helpers/layout_helper.rb b/app/helpers/layout_helper.rb index 0cc91f6..f8388a0 100644 --- a/app/helpers/layout_helper.rb +++ b/app/helpers/layout_helper.rb @@ -11,7 +11,8 @@ module LayoutHelper # def parent_layout(layout) @view_flow.set(:layout, output_buffer) - output = render(:file => Rails.root.join("app/views/layouts/#{layout}.html.erb")) + output = render(file: Rails.root.join("app/views/layouts/#{layout}.html.erb")) + self.output_buffer = ActionView::OutputBuffer.new(output) end end diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index be29ec4..39e37fc 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -14,7 +14,7 @@
- <%= image_tag('services/1.jpg', alt: 'What is MENAdevs') %> + <%# image_tag("/assets/services/1.jpg", alt: 'What is MENAdevs') %>

What is MENAdevsA group to belong to

@@ -26,7 +26,7 @@
- <%= image_tag('services/2.jpg', alt: 'Our mission') %> + <%# image_tag("/assets/services/2.jpg", alt: 'Our mission') %>

Our MissionTo learn, have fun, exchange knowledge

@@ -38,7 +38,7 @@
- <%= image_tag('services/3.jpg', alt: 'What is our aim') %> + <%# image_tag("/assets/services/3.jpg", alt: 'What is our aim') %>

What is our aim To produce

diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e510e58..ff8eff8 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,68 +1,79 @@ -<%# The "application" layout is the default layout. It extends "base" %> -<%# to include things like header, footer, and alerts that are common %> -<%# to most (but not all) views. %> - - + + + + + -
- - - - -
- - <%= render("shared/flash") %> - - <%= yield %> - - -
- -
- - <%= render("shared/footer") %> - -
- -
- -
- -
- -<% if Rails.env.production? %> - <%= render("shared/analytics") %> -<% end %> - -<%= content_for :javascript do %> - <%= javascript_include_async_tag('plugins.js', +
+
+ <%= render("shared/footer") %> +
+
+
+
+ <% if Rails.env.production? %> + <%= render("shared/analytics") %> + <% end %> + <%= content_for :javascript do %> + <%= javascript_include_async_tag('plugins.js', 'data-turbolinks-track': false) %> - <%= javascript_include_async_tag('functions.js', + <%= javascript_include_async_tag('functions.js', 'data-turbolinks-track': false) %> -<% end %> - -<% parent_layout "base" %> \ No newline at end of file + <% end %> + <%= yield(:javascript) %> + + \ No newline at end of file diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb index 9e3ea64..848af7a 100644 --- a/app/views/layouts/base.html.erb +++ b/app/views/layouts/base.html.erb @@ -3,50 +3,79 @@ - <%= csrf_meta_tags %> - <%# CSS should go closest to the top of the document as possible. %> <%= stylesheet_link_tag('application', media: 'all', 'data-turbolinks-track': false) %> - <%# JavaScript must be in head for Turbolinks to work. %> <%= javascript_include_async_tag('application', 'data-turbolinks-track': false) %> - <%= yield(:head) %> - <%# Specifies the default name of home screen bookmark in iOS 6+ %> - <%= display_meta_tags site: AppSettings.application_name %> - - - - - <%= yield %> - - <%= yield(:javascript) %> - - + +
+ + +
+ <%= render("shared/flash") %> + <%= yield %> + + +
+
+ <%= render("shared/footer") %> +
+
+
+
+ <% if Rails.env.production? %> + <%= render("shared/analytics") %> + <% end %> + <%= content_for :javascript do %> + <%= javascript_include_async_tag('plugins.js', + 'data-turbolinks-track': false) %> + <%= javascript_include_async_tag('functions.js', + 'data-turbolinks-track': false) %> + <% end %> + <%= yield(:javascript) %> + +