diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 2dbb133ec..b57177ef0 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -24,7 +24,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 2.5.9 + ruby-version: 2.7.2 bundler-cache: true env: BUNDLE_JOBS: 4 diff --git a/.gitignore b/.gitignore index a6ebe0092..da36bf7e4 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,21 @@ # Ignore all logfiles and tempfiles. /log/*.log /tmp +!/tmp/.keep + +# Ignore uploaded files in development +/storage/* +!/storage/.keep + +/node_modules +/yarn-error.log + +/public/assets +.byebug_history + +# Ignore master key for decrypting credentials and more. +/config/master.key + /coverage/ TAGS diff --git a/.ruby-version b/.ruby-version index 30f69e8cc..37c2961c2 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.5.9 +2.7.2 diff --git a/Dockerfile b/Dockerfile index 81502480b..aa3da7f29 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ -FROM ruby:2.5.9 +FROM ruby:2.7.2 # Default node version on apt is old. This makes sure a recent version is installed # This step also runs apt-get update -RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - +RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - RUN apt-get install -y --force-yes build-essential libpq-dev nodejs # Install latest chrome dev package @@ -17,6 +17,6 @@ RUN set -ex; \ WORKDIR /planner COPY Gemfile Gemfile.lock ./ -RUN bundle install +RUN bundle install --jobs 4 COPY . ./ diff --git a/Gemfile b/Gemfile index aa6bd382c..beb26b377 100644 --- a/Gemfile +++ b/Gemfile @@ -1,39 +1,42 @@ source 'https://rubygems.org' -ruby '2.5.9' +ruby '2.7.2' -gem 'rails', '4.2.11.3' +gem 'rails', '5.2.8.1' +# Reduces boot times through caching; required in config/boot.rb +gem 'bootsnap', '>= 1.1.0', require: false -gem 'acts-as-taggable-on', '~> 5.0' +gem 'acts-as-taggable-on' gem 'carrierwave' gem 'carrierwave-ftp', require: 'carrierwave/storage/sftp' gem 'cocoon' gem 'delayed_job' gem 'delayed_job_active_record' gem 'font_awesome5_rails' -gem 'bootstrap', '~> 5.0.0.alpha1' +gem 'bootstrap', '~> 5' gem 'friendly_id' gem 'haml' gem 'high_voltage' gem 'jquery-rails' -gem 'jquery-ui-rails', '~> 6.0.1' +gem 'jquery-ui-rails' +# Use ActiveStorage variant gem 'mini_magick' gem 'nokogiri' gem 'omniauth' gem 'omniauth-github' -gem 'omniauth-rails_csrf_protection', '~> 0.1' -gem 'pg', '~>0.20.0' +gem 'omniauth-rails_csrf_protection' +gem 'pg' gem 'pickadate-rails' gem 'premailer-rails' gem 'puma' gem 'pundit' gem 'rails4-autocomplete' gem 'rolify' -gem 'sass-rails', '~> 5.0.1' +gem 'sassc-rails' gem 'simple_form' gem 'turbolinks' -gem 'uglifier', '>= 1.3.0' +gem 'uglifier' gem 'will_paginate' -gem 'sprockets-rails', '3.2.2' +gem 'sprockets-rails' gem 'icalendar' gem 'tzinfo-data' @@ -53,6 +56,12 @@ gem 'public_activity' group :development do gem 'better_errors' gem 'letter_opener' + # Access an interactive console on exception pages or by calling 'console' anywhere in the code. + gem 'web-console', '>= 3.3.0' + gem 'listen', '>= 3.0.5', '< 3.2' + # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'spring' + gem 'spring-watcher-listen', '~> 2.0.0' end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index d57fd4ab2..d99223bb6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,267 +1,295 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.11.3) - actionpack (= 4.2.11.3) - actionview (= 4.2.11.3) - activejob (= 4.2.11.3) + actioncable (5.2.8.1) + actionpack (= 5.2.8.1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.8.1) + actionpack (= 5.2.8.1) + actionview (= 5.2.8.1) + activejob (= 5.2.8.1) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.11.3) - actionview (= 4.2.11.3) - activesupport (= 4.2.11.3) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) + actionpack (5.2.8.1) + actionview (= 5.2.8.1) + activesupport (= 5.2.8.1) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.11.3) - activesupport (= 4.2.11.3) + actionview (5.2.8.1) + activesupport (= 5.2.8.1) builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (4.2.11.3) - activesupport (= 4.2.11.3) - globalid (>= 0.3.0) - activemodel (4.2.11.3) - activesupport (= 4.2.11.3) - builder (~> 3.1) - activerecord (4.2.11.3) - activemodel (= 4.2.11.3) - activesupport (= 4.2.11.3) - arel (~> 6.0) - activesupport (4.2.11.3) - i18n (~> 0.7) + activejob (5.2.8.1) + activesupport (= 5.2.8.1) + globalid (>= 0.3.6) + activemodel (5.2.8.1) + activesupport (= 5.2.8.1) + activerecord (5.2.8.1) + activemodel (= 5.2.8.1) + activesupport (= 5.2.8.1) + arel (>= 9.0) + activestorage (5.2.8.1) + actionpack (= 5.2.8.1) + activerecord (= 5.2.8.1) + marcel (~> 1.0.0) + activesupport (5.2.8.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - acts-as-taggable-on (5.0.0) - activerecord (>= 4.2.8) - addressable (2.8.1) + acts-as-taggable-on (8.1.0) + activerecord (>= 5.0, < 6.2) + addressable (2.8.4) public_suffix (>= 2.0.2, < 6.0) - arel (6.0.4) + arel (9.0.0) ast (2.4.2) - autoprefixer-rails (10.3.1.0) + autoprefixer-rails (10.4.13.0) execjs (~> 2) - better_errors (2.9.1) - coderay (>= 1.0.0) + better_errors (2.10.1) erubi (>= 1.0.0) rack (>= 0.9.0) - bootstrap (5.0.0.alpha1) + rouge (>= 1.0.0) + bindex (0.8.1) + bootsnap (1.16.0) + msgpack (~> 1.2) + bootstrap (5.2.3) autoprefixer-rails (>= 9.1.0) - popper_js (>= 1.14.3, < 2) + popper_js (>= 2.11.6, < 3) sassc-rails (>= 2.0.0) builder (3.2.4) - bullet (6.1.5) + bullet (7.0.7) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (11.1.3) - capybara (3.32.2) + capybara (3.39.2) addressable + matrix 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) - carrierwave (1.3.2) - activemodel (>= 4.0.0) - activesupport (>= 4.0.0) - mime-types (>= 1.16) + carrierwave (2.2.4) + activemodel (>= 5.0.0) + activesupport (>= 5.0.0) + addressable (~> 2.6) + image_processing (~> 1.1) + marcel (~> 1.0.0) + mini_mime (>= 0.1.3) ssrf_filter (~> 1.0) carrierwave-ftp (0.4.1) carrierwave (>= 0.6.2) double-bag-ftps (= 0.1.3) net-sftp (~> 2.1.2) - childprocess (3.0.0) chosen-rails (1.10.0) coffee-rails (>= 3.2) railties (>= 3.0) sassc-rails (>= 2.1.2) cocoon (1.2.15) coderay (1.1.3) - coffee-rails (4.2.2) + coffee-rails (5.0.0) coffee-script (>= 2.2.0) - railties (>= 4.0.0) + railties (>= 5.2.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) - commonmarker (0.21.1) - ruby-enum (~> 0.5) - concurrent-ruby (1.1.10) + commonmarker (0.23.9) + concurrent-ruby (1.2.2) crass (1.0.6) - css_parser (1.7.1) + css_parser (1.14.0) addressable - database_cleaner (1.99.0) - delayed_job (4.1.9) - activesupport (>= 3.0, < 6.2) - delayed_job_active_record (4.1.6) - activerecord (>= 3.0, < 6.2) + database_cleaner (2.0.2) + database_cleaner-active_record (>= 2, < 3) + database_cleaner-active_record (2.1.0) + activerecord (>= 5.a) + database_cleaner-core (~> 2.0.0) + database_cleaner-core (2.0.1) + date (3.3.3) + delayed_job (4.1.11) + activesupport (>= 3.0, < 8.0) + delayed_job_active_record (4.1.7) + activerecord (>= 3.0, < 8.0) delayed_job (>= 3.0, < 5) diff-lcs (1.5.0) - docile (1.3.5) - dotenv (2.7.6) - dotenv-rails (2.7.6) - dotenv (= 2.7.6) + docile (1.4.0) + dotenv (2.8.1) + dotenv-rails (2.8.1) + dotenv (= 2.8.1) railties (>= 3.2) double-bag-ftps (0.1.3) - erubi (1.10.0) - erubis (2.7.0) + erubi (1.12.0) execjs (2.8.1) - fabrication (2.21.1) - faker (2.2.1) - i18n (>= 0.8) - faraday (1.10.1) - faraday-em_http (~> 1.0) - faraday-em_synchrony (~> 1.0) - faraday-excon (~> 1.1) - faraday-httpclient (~> 1.0) - faraday-multipart (~> 1.0) - faraday-net_http (~> 1.0) - faraday-net_http_persistent (~> 1.0) - faraday-patron (~> 1.0) - faraday-rack (~> 1.0) - faraday-retry (~> 1.0) + fabrication (2.30.0) + faker (3.2.0) + i18n (>= 1.8.11, < 2) + faraday (2.7.10) + faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) - faraday-em_http (1.0.0) - faraday-em_synchrony (1.0.0) - faraday-excon (1.1.0) - faraday-httpclient (1.0.1) - faraday-multipart (1.0.4) - multipart-post (~> 2) - faraday-net_http (1.0.1) - faraday-net_http_persistent (1.2.0) - faraday-patron (1.0.0) - faraday-rack (1.0.0) - faraday-retry (1.0.3) + faraday-net_http (3.0.2) ffi (1.15.5) - font_awesome5_rails (1.4.0) + font_awesome5_rails (1.5.0) + nokogiri (>= 1.11.3) railties (>= 4.2) foreman (0.87.2) - friendly_id (5.4.2) + friendly_id (5.5.0) activerecord (>= 4.0.0) gibbon (3.4.4) faraday (>= 1.0) multi_json (>= 1.11.0) - globalid (0.4.2) - activesupport (>= 4.2.0) - haml (5.2.0) - temple (>= 0.8.0) + globalid (1.1.0) + activesupport (>= 5.0) + haml (6.1.1) + temple (>= 0.8.2) + thor tilt hashie (5.0.0) high_voltage (3.1.2) htmlentities (4.3.4) - i18n (0.9.5) + i18n (1.14.1) concurrent-ruby (~> 1.0) icalendar (2.8.0) ice_cube (~> 0.16) ice_cube (0.16.4) - jbuilder (2.9.1) - activesupport (>= 4.2.0) - jquery-rails (3.1.4) - railties (>= 3.0, < 5.0) + image_processing (1.12.2) + mini_magick (>= 4.9.5, < 5) + ruby-vips (>= 2.0.17, < 3) + jbuilder (2.11.5) + actionview (>= 5.0.0) + activesupport (>= 5.0.0) + jquery-rails (4.6.0) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) - jwt (2.2.1) + jwt (2.7.1) launchy (2.5.2) addressable (~> 2.8) letter_opener (1.8.1) launchy (>= 2.2, < 3) - loofah (2.19.1) + listen (3.1.5) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) + loofah (2.21.3) crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) + nokogiri (>= 1.12.0) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.2) + matrix (0.4.2) method_source (1.0.0) - mime-types (3.3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2020.1104) mini_magick (4.12.0) - mini_mime (1.0.2) - mini_portile2 (2.4.0) - minitest (5.15.0) + mini_mime (1.1.2) + mini_portile2 (2.8.4) + minitest (5.18.1) + msgpack (1.7.2) multi_json (1.15.0) multi_xml (0.6.0) - multipart-post (2.2.3) + net-imap (0.3.6) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout net-sftp (2.1.2) net-ssh (>= 2.6.5) - net-ssh (5.0.2) - nio4r (2.5.8) - nokogiri (1.10.10) - mini_portile2 (~> 2.4.0) - oauth2 (1.4.4) - faraday (>= 0.8, < 2.0) + net-smtp (0.3.3) + net-protocol + net-ssh (7.1.0) + nio4r (2.5.9) + nokogiri (1.15.3) + mini_portile2 (~> 2.8.2) + racc (~> 1.4) + oauth2 (2.0.9) + faraday (>= 0.17.3, < 3.0) jwt (>= 1.0, < 3.0) - multi_json (~> 1.3) multi_xml (~> 0.5) - rack (>= 1.2, < 3) - omniauth (1.9.2) + rack (>= 1.2, < 4) + snaky_hash (~> 2.0) + version_gem (~> 1.1) + omniauth (2.1.1) hashie (>= 3.4.6) - rack (>= 1.6.2, < 3) - omniauth-github (1.4.0) - omniauth (~> 1.5) - omniauth-oauth2 (>= 1.4.0, < 2.0) - omniauth-oauth2 (1.6.0) - oauth2 (~> 1.1) - omniauth (~> 1.9) - omniauth-rails_csrf_protection (0.1.2) + rack (>= 2.2.3) + rack-protection + omniauth-github (2.0.1) + omniauth (~> 2.0) + omniauth-oauth2 (~> 1.8) + omniauth-oauth2 (1.8.0) + oauth2 (>= 1.4, < 3) + omniauth (~> 2.0) + omniauth-rails_csrf_protection (1.0.1) actionpack (>= 4.2) - omniauth (>= 1.3.1) - parallel (1.20.1) - parser (3.0.2.0) + omniauth (~> 2.0) + parallel (1.23.0) + parser (3.2.2.3) ast (~> 2.4.1) - pg (0.20.0) + racc + pg (1.5.3) pickadate-rails (3.5.6.0) railties (>= 3.1.0) - popper_js (1.16.0) - premailer (1.11.1) + popper_js (2.11.7) + premailer (1.21.0) addressable - css_parser (>= 1.6.0) + css_parser (>= 1.12.0) htmlentities (>= 4.0.0) - premailer-rails (1.11.1) + premailer-rails (1.12.0) actionmailer (>= 3) + net-smtp premailer (~> 1.7, >= 1.7.9) - pry (0.13.1) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - pry-byebug (3.9.0) + pry-byebug (3.10.1) byebug (~> 11.0) - pry (~> 0.13.0) + pry (>= 0.13, < 0.15) pry-remote (0.1.8) pry (~> 0.9) slop (~> 3.0) - public_activity (1.6.4) - actionpack (>= 3.0.0) - activerecord (>= 3.0) + public_activity (2.0.2) + actionpack (>= 5.0.0) + activerecord (>= 5.0) i18n (>= 0.5.0) - railties (>= 3.0.0) - public_suffix (4.0.7) - puma (4.3.9) + railties (>= 5.0.0) + public_suffix (5.0.3) + puma (6.3.0) nio4r (~> 2.0) - pundit (2.1.0) + pundit (2.3.1) activesupport (>= 3.0.0) - rack (1.6.13) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.11.3) - actionmailer (= 4.2.11.3) - actionpack (= 4.2.11.3) - actionview (= 4.2.11.3) - activejob (= 4.2.11.3) - activemodel (= 4.2.11.3) - activerecord (= 4.2.11.3) - activesupport (= 4.2.11.3) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.11.3) - sprockets-rails - rails-deprecated_sanitizer (1.0.4) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.9) - activesupport (>= 4.2.0, < 5.0) - nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) + racc (1.7.1) + rack (2.2.7) + rack-protection (3.0.6) + rack + rack-test (2.1.0) + rack (>= 1.3) + rails (5.2.8.1) + actioncable (= 5.2.8.1) + actionmailer (= 5.2.8.1) + actionpack (= 5.2.8.1) + actionview (= 5.2.8.1) + activejob (= 5.2.8.1) + activemodel (= 5.2.8.1) + activerecord (= 5.2.8.1) + activestorage (= 5.2.8.1) + activesupport (= 5.2.8.1) + bundler (>= 1.3.0) + railties (= 5.2.8.1) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.1.1) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) rails-html-sanitizer (1.4.4) loofah (~> 2.19, >= 2.19.1) rails4-autocomplete (1.1.1) @@ -269,38 +297,43 @@ GEM rails_12factor (0.0.3) rails_serve_static_assets rails_stdout_logging - rails_serve_static_assets (0.0.4) - rails_stdout_logging (0.0.4) - railties (4.2.11.3) - actionpack (= 4.2.11.3) - activesupport (= 4.2.11.3) + rails_serve_static_assets (0.0.5) + rails_stdout_logging (0.0.5) + railties (5.2.8.1) + actionpack (= 5.2.8.1) + activesupport (= 5.2.8.1) + method_source rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rainbow (3.0.0) + thor (>= 0.19.0, < 2.0) + rainbow (3.1.1) rake (13.0.6) - regexp_parser (1.8.2) + rb-fsevent (0.11.2) + rb-inotify (0.10.1) + ffi (~> 1.0) + regexp_parser (2.8.1) rexml (3.2.5) - rolify (5.3.0) + rolify (6.0.1) rollbar (3.4.0) + rouge (4.1.2) rspec-collection_matchers (1.2.0) rspec-expectations (>= 2.99.0.beta1) - rspec-core (3.12.0) + rspec-core (3.12.2) rspec-support (~> 3.12.0) - rspec-expectations (3.12.1) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-mocks (3.12.1) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-rails (4.1.2) - actionpack (>= 4.2) - activesupport (>= 4.2) - railties (>= 4.2) + rspec-rails (5.1.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + railties (>= 5.2) rspec-core (~> 3.10) rspec-expectations (~> 3.10) rspec-mocks (~> 3.10) rspec-support (~> 3.10) - rspec-support (3.12.0) + rspec-support (3.12.1) rubocop (1.12.1) parallel (~> 1.10) parser (>= 3.0.0.0) @@ -310,30 +343,24 @@ GEM rubocop-ast (>= 1.2.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.4.1) - parser (>= 2.7.1.5) - rubocop-performance (1.10.2) - rubocop (>= 0.90.0, < 2.0) + rubocop-ast (1.29.0) + parser (>= 3.2.1.0) + rubocop-performance (1.18.0) + rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.9.1) + rubocop-rails (2.15.2) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.90.0, < 2.0) - rubocop-rspec (2.2.0) + rubocop (>= 1.7.0, < 2.0) + rubocop-rspec (2.4.0) rubocop (~> 1.0) rubocop-ast (>= 1.1.0) - ruby-enum (0.9.0) - i18n - ruby-progressbar (1.11.0) + ruby-progressbar (1.13.0) + ruby-vips (2.1.4) + ffi (~> 1.12) ruby2_keywords (0.0.5) - rubyzip (2.3.0) - sass (3.4.25) - sass-rails (5.0.7) - railties (>= 4.0.0, < 6) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) + ruby_dep (1.5.0) + rubyzip (2.3.2) sassc (2.4.0) ffi (~> 1.9) sassc-rails (2.1.2) @@ -342,53 +369,72 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (3.142.7) - childprocess (>= 0.5, < 4.0) - rubyzip (>= 1.2.2) + selenium-webdriver (4.9.0) + rexml (~> 3.2, >= 3.2.5) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) shoulda-matchers (4.5.1) activesupport (>= 4.2.0) - simple_form (4.0.0) - actionpack (> 4) - activemodel (> 4) - simplecov (0.18.5) + simple_form (5.2.0) + actionpack (>= 5.2) + activemodel (>= 5.2) + simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov-lcov (0.8.0) - skylight (4.3.2) - skylight-core (= 4.3.2) - skylight-core (4.3.2) - activesupport (>= 4.2.0) + simplecov_json_formatter (0.1.4) + skylight (5.3.4) + activesupport (>= 5.2.0) slop (3.6.0) - sprockets (3.7.2) + snaky_hash (2.0.1) + hashie + version_gem (~> 1.1, >= 1.1.1) + spring (2.1.1) + spring-watcher-listen (2.0.1) + listen (>= 2.7, < 4.0) + spring (>= 1.2, < 3.0) + sprockets (4.2.0) concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) + rack (>= 2.2.4, < 4) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) - ssrf_filter (1.0.7) - stripe (5.39.0) - temple (0.8.2) - thor (1.2.1) + ssrf_filter (1.1.1) + stripe (8.6.0) + temple (0.10.2) + thor (1.2.2) thread_safe (0.3.6) - tilt (2.0.10) + tilt (2.2.0) + timeout (0.4.0) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - tzinfo (1.2.10) + tzinfo (1.2.11) thread_safe (~> 0.1) - tzinfo-data (1.2021.1) + tzinfo-data (1.2023.3) tzinfo (>= 1.0.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) - unicode-display_width (2.1.0) - uniform_notifier (1.14.2) - webdrivers (4.4.1) + unicode-display_width (2.4.2) + uniform_notifier (1.16.0) + version_gem (1.1.3) + web-console (3.7.0) + actionview (>= 5.0) + activemodel (>= 5.0) + bindex (>= 0.4.0) + railties (>= 5.0) + webdrivers (5.2.0) nokogiri (~> 1.6) rubyzip (>= 1.3.0) - selenium-webdriver (>= 3.0, < 4.0) - will_paginate (3.3.1) + selenium-webdriver (~> 4.0) + websocket (1.2.9) + websocket-driver (0.7.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + will_paginate (4.0.0) xpath (3.2.0) nokogiri (~> 1.8) @@ -396,9 +442,10 @@ PLATFORMS ruby DEPENDENCIES - acts-as-taggable-on (~> 5.0) + acts-as-taggable-on better_errors - bootstrap (~> 5.0.0.alpha1) + bootsnap (>= 1.1.0) + bootstrap (~> 5) bullet capybara carrierwave @@ -421,15 +468,16 @@ DEPENDENCIES icalendar jbuilder jquery-rails - jquery-ui-rails (~> 6.0.1) + jquery-ui-rails launchy letter_opener + listen (>= 3.0.5, < 3.2) mini_magick nokogiri omniauth omniauth-github - omniauth-rails_csrf_protection (~> 0.1) - pg (~> 0.20.0) + omniauth-rails_csrf_protection + pg pickadate-rails premailer-rails pry-byebug @@ -437,7 +485,7 @@ DEPENDENCIES public_activity puma pundit - rails (= 4.2.11.3) + rails (= 5.2.8.1) rails-html-sanitizer (~> 1.4.4) rails4-autocomplete rails_12factor @@ -449,22 +497,25 @@ DEPENDENCIES rubocop-performance rubocop-rails rubocop-rspec - sass-rails (~> 5.0.1) + sassc-rails shoulda-matchers (~> 4.5) simple_form simplecov simplecov-lcov skylight - sprockets-rails (= 3.2.2) + spring + spring-watcher-listen (~> 2.0.0) + sprockets-rails stripe turbolinks tzinfo-data - uglifier (>= 1.3.0) + uglifier + web-console (>= 3.3.0) webdrivers will_paginate RUBY VERSION - ruby 2.5.9p229 + ruby 2.7.2p137 BUNDLED WITH - 1.17.3 + 2.4.17 diff --git a/Makefile b/Makefile index f2c078cc4..650ee21a8 100644 --- a/Makefile +++ b/Makefile @@ -20,3 +20,5 @@ deploy_staging: git push staging master heroku run rake db:migrate --app=codebar-staging heroku maintenance:off --app=codebar-staging +serve: + rm -f ./tmp/pids/server.pid && bundle exec rails server --binding=0.0.0.0 --port=3000 diff --git a/Rakefile b/Rakefile index fca01fd8c..e85f91391 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,6 @@ # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require File.expand_path('config/application', __dir__) +require_relative 'config/application' -Planner::Application.load_tasks +Rails.application.load_tasks diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 000000000..b16e53d6d --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,3 @@ +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 4ca3c25ed..dfb1202ae 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -13,7 +13,8 @@ //= require popper //= require bootstrap //= require jquery -//= require jquery_ujs +//= require rails-ujs +//= require activestorage //= require jquery-ui //= require autocomplete-rails //= require chosen-jquery diff --git a/app/assets/javascripts/invitations.js b/app/assets/javascripts/invitations.js index 1cc0cf8aa..7a496b8f3 100644 --- a/app/assets/javascripts/invitations.js +++ b/app/assets/javascripts/invitations.js @@ -1,5 +1,6 @@ $(document).ready(function() { - $(document).on("ajax:success", "a[data-remote]", function(e, data, status, xhr) { + $(document).on("ajax:success", "#invitations [data-remote]", function(e) { + var xhr = e.detail[2]; var $invitations = $("#invitations"); $invitations.html(xhr.responseText); @@ -11,6 +12,15 @@ $(document).ready(function() { }); $(document).on('change','#workshop_invitations ',function() { - this.form.submit(); + // Rails 5.1 has dropped jquery as a dependency and therefore has replaced jquery-ujs with a complete rewritten rails-ujs. + // See: + // + http://weblog.rubyonrails.org/2017/4/27/Rails-5-1-final/ + // + https://stackoverflow.com/questions/12683524/with-rails-ujs-how-to-submit-a-remote-form-from-a-function + // As such, you'll have to trigger the proper CustomEvent object in rails-ujs. + // + // NOTE: Without this, if we simply call this.form.submit() then we get a 500 HTTP status code and the following logs: + // Can't verify CSRF token authenticity. + // ActionController::InvalidAuthenticityToken + Rails.fire(this.form, 'submit'); }) }); diff --git a/app/assets/javascripts/subscriptions-toggle.js b/app/assets/javascripts/subscriptions-toggle.js index f2ffd6b7c..c8b7ec3f4 100644 --- a/app/assets/javascripts/subscriptions-toggle.js +++ b/app/assets/javascripts/subscriptions-toggle.js @@ -5,11 +5,11 @@ /* global $ */ $(() => - $(".subscriptions .toggle").click(function (e) { + $(".subscriptions .codebar-toggle").click(function (e) { const $section = $(e.target).closest(".subscriptions"); const $container = $(".group-container", $section); - const $icon = $(".toggle i", $section); - $container.slideToggle(400, () => $container.toggleClass("collapsed")); + const $icon = $(".codebar-toggle i", $section); + $container.slideToggle(400, () => $container.toggleClass("codebar-collapsed")); $icon.toggleClass("fa-chevron-right fa-chevron-down"); }) ); diff --git a/app/assets/stylesheets/_bootstrap-custom.scss b/app/assets/stylesheets/_bootstrap-custom.scss index 45675ebce..6f0237c55 100644 --- a/app/assets/stylesheets/_bootstrap-custom.scss +++ b/app/assets/stylesheets/_bootstrap-custom.scss @@ -11,6 +11,8 @@ $enable-negative-margins: true; // Configuration @import "bootstrap/functions"; @import "bootstrap/variables"; +// https://stackoverflow.com/questions/73054062/sasserror-undefined-variable-failing-dependencies +@import "bootstrap/maps"; @import "bootstrap/mixins"; @import "bootstrap/utilities"; diff --git a/app/assets/stylesheets/main.scss b/app/assets/stylesheets/main.scss index 87ba4171e..754c03671 100644 --- a/app/assets/stylesheets/main.scss +++ b/app/assets/stylesheets/main.scss @@ -1,13 +1,13 @@ /* Show/hide togglable elements are controlled by JavaScript. */ -.toggle { +.codebar-toggle { cursor: pointer; } -.collapsed { +.codebar-collapsed { display: none; } -.no-js .collapsed { +.no-js .codebar-collapsed { display: block; } diff --git a/app/controllers/admin/application_controller.rb b/app/controllers/admin/application_controller.rb index 7ca5f6db5..8f7b10eb3 100644 --- a/app/controllers/admin/application_controller.rb +++ b/app/controllers/admin/application_controller.rb @@ -1,5 +1,5 @@ class Admin::ApplicationController < ApplicationController - include Pundit + include Pundit::Authorization before_action :authenticate_admin_or_organiser! end diff --git a/app/controllers/admin/events_controller.rb b/app/controllers/admin/events_controller.rb index 2cdbbedaf..61e7f0910 100644 --- a/app/controllers/admin/events_controller.rb +++ b/app/controllers/admin/events_controller.rb @@ -27,7 +27,7 @@ def show @attending_students = InvitationPresenter.decorate_collection(@original_event.attending_students) @attending_coaches = InvitationPresenter.decorate_collection(@original_event.attending_coaches) - return render text: @event.attendees_csv if request.format.csv? + return render plain: @event.attendees_csv if request.format.csv? end def update @@ -59,7 +59,7 @@ def attendees_emails @list = "STUDENTS\n\n" + students + "\n\nCOACHES\n\n" + coaches - return render text: @list if request.format.text? + return render plain: @list if request.format.text? redirect_to admin_event_path(event) end diff --git a/app/controllers/admin/invitation_controller.rb b/app/controllers/admin/invitation_controller.rb index c7699efa4..0b9be860c 100644 --- a/app/controllers/admin/invitation_controller.rb +++ b/app/controllers/admin/invitation_controller.rb @@ -9,7 +9,10 @@ def update EventInvitationMailer.attending(invitation.event, invitation.member, invitation).deliver_now - redirect_to :back, notice: "You have verified #{invitation.member.full_name}'s spot at the event!" + redirect_back( + fallback_location: root_path, + notice: "You have verified #{invitation.member.full_name}'s spot at the event!" + ) end def verify @@ -18,13 +21,19 @@ def verify EventInvitationMailer.attending(invitation.event, invitation.member, invitation).deliver_now - redirect_to :back, notice: "You have verified #{invitation.member.full_name}'s spot at the event!" + redirect_back( + fallback_location: root_path, + notice: "You have verified #{invitation.member.full_name}'s spot at the event!" + ) end def cancel invitation = Invitation.find_by(token: params[:invitation_id]) invitation.update(attending: false) - redirect_to :back, notice: "You have cancelled #{invitation.member.full_name}'s attendance." + redirect_back( + fallback_location: root_path, + notice: "You have cancelled #{invitation.member.full_name}'s attendance." + ) end end diff --git a/app/controllers/admin/invitations_controller.rb b/app/controllers/admin/invitations_controller.rb index 7ade6d817..c9d654997 100644 --- a/app/controllers/admin/invitations_controller.rb +++ b/app/controllers/admin/invitations_controller.rb @@ -12,7 +12,7 @@ def update set_admin_workshop_data render partial: 'admin/workshops/invitation_management' else - redirect_to :back, notice: message + redirect_back fallback_location: root_path, notice: message end end diff --git a/app/controllers/admin/meetings_controller.rb b/app/controllers/admin/meetings_controller.rb index f320e7e91..8a21c1715 100644 --- a/app/controllers/admin/meetings_controller.rb +++ b/app/controllers/admin/meetings_controller.rb @@ -21,7 +21,7 @@ def create def show @invitations = @meeting.invitations.accepted.includes(:member).order(:created_at) - return render text: @meeting.attendees_csv if request.format.csv? + return render plain: @meeting.attendees_csv if request.format.csv? end def edit; end @@ -40,7 +40,7 @@ def update def attendees_emails meeting = MeetingPresenter.new(@meeting) - return render text: meeting.attendees_emails if request.format.text? + return render plain: meeting.attendees_emails if request.format.text? redirect_to admin_meeting_path(@meeting) end diff --git a/app/controllers/admin/member_notes_controller.rb b/app/controllers/admin/member_notes_controller.rb index 95f7078dc..2f2e4f0b7 100644 --- a/app/controllers/admin/member_notes_controller.rb +++ b/app/controllers/admin/member_notes_controller.rb @@ -5,7 +5,7 @@ def create @note.author = current_user flash[:error] = @note.errors.full_messages unless @note.save - redirect_to :back + redirect_back fallback_location: root_path end def member_note_params diff --git a/app/controllers/admin/members_controller.rb b/app/controllers/admin/members_controller.rb index e8a515446..3049073d1 100644 --- a/app/controllers/admin/members_controller.rb +++ b/app/controllers/admin/members_controller.rb @@ -22,7 +22,7 @@ def update_subscriptions chapter: subscription.group.chapter.city, group: subscription.group.name) subscription.destroy - redirect_to :back + redirect_back fallback_location: root_path end def send_eligibility_email diff --git a/app/controllers/admin/workshops_controller.rb b/app/controllers/admin/workshops_controller.rb index 39e816784..2afe00080 100644 --- a/app/controllers/admin/workshops_controller.rb +++ b/app/controllers/admin/workshops_controller.rb @@ -42,7 +42,7 @@ def show @workshop = WorkshopPresenter.decorate(@workshop) if request.format.csv? csv_to_render = params[:type].eql?('labels') ? @workshop.attendees_csv : @workshop.pairing_csv - return render text: csv_to_render + return render plain: csv_to_render end set_admin_workshop_data @@ -67,14 +67,14 @@ def update def send_invites; end def attendees_checklist - return render text: @workshop.attendees_checklist if request.format.text? + return render plain: @workshop.attendees_checklist if request.format.text? redirect_to admin_workshop_path(@workshop), notice: I18n.t('messages.invalid_format', invalid_format: request.format) end def attendees_emails - return render text: @workshop.attendees_emails if request.format.text? + return render plain: @workshop.attendees_emails if request.format.text? redirect_to admin_workshop_path(@workshop) end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 04a3fb607..2a4fb4522 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,7 +1,7 @@ class ApplicationController < ActionController::Base protect_from_forgery with: :exception - include Pundit + include Pundit::Authorization rescue_from Exception do |ex| Rollbar.error(ex) diff --git a/app/controllers/concerns/admin/sponsor_concerns.rb b/app/controllers/concerns/admin/sponsor_concerns.rb index 29afb7aee..06673603d 100644 --- a/app/controllers/concerns/admin/sponsor_concerns.rb +++ b/app/controllers/concerns/admin/sponsor_concerns.rb @@ -15,13 +15,13 @@ def sponsor else flash[:notice] = workshop_sponsors.errors.full_messages.to_s end - redirect_to :back + redirect_back fallback_location: root_path end def destroy_sponsor @sponsor = Sponsor.find(params[:sponsor_id]) @workshop.workshop_sponsors.find_by(sponsor: @sponsor).destroy - redirect_to :back + redirect_back fallback_location: root_path end def host @@ -30,13 +30,13 @@ def host @workshop_sponsor.update_attribute(:host, true) flash[:notice] = 'Host set successfully' - redirect_to :back + redirect_back fallback_location: root_path end def destroy_host @workshop.workshop_sponsors.find_by(host: true).update_attribute(:host, false) - redirect_to :back + redirect_back fallback_location: root_path end private diff --git a/app/controllers/concerns/invitation_controller_concerns.rb b/app/controllers/concerns/invitation_controller_concerns.rb index a731e6f5d..62c8cfc58 100644 --- a/app/controllers/concerns/invitation_controller_concerns.rb +++ b/app/controllers/concerns/invitation_controller_concerns.rb @@ -51,12 +51,16 @@ def reject @workshop.send_attending_email(invitation, true) end - redirect_back(fallback_location: invitation_path(@invitation), - notice: t('messages.rejected_invitation', name: @invitation.member.name)) + redirect_back( + fallback_location: invitation_path(@invitation), + notice: t('messages.rejected_invitation', name: @invitation.member.name) + ) end else - redirect_back(fallback_location: invitation_path(@invitation), - notice: 'You can only change your RSVP status up to 3.5 hours before the workshop') + redirect_back( + fallback_location: invitation_path(@invitation), + notice: 'You can only change your RSVP status up to 3.5 hours before the workshop' + ) end end diff --git a/app/controllers/invitation_controller.rb b/app/controllers/invitation_controller.rb index a6b91ed21..fb9d57dbb 100644 --- a/app/controllers/invitation_controller.rb +++ b/app/controllers/invitation_controller.rb @@ -7,7 +7,7 @@ def show @workshop = WorkshopPresenter.decorate(@invitation.workshop) - render text: @workshop.attendees_csv if request.format.csv? + render plain: @workshop.attendees_csv if request.format.csv? end def update diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index 39510b958..fb4964b26 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -24,7 +24,7 @@ def show def attend event = @invitation.event - return redirect_to :back, notice: t('messages.already_rsvped') if @invitation.attending? + return redirect_back fallback_location: root_path, notice: t('messages.already_rsvped') if @invitation.attending? if @invitation.student_spaces? || @invitation.coach_spaces? @invitation.update_attribute(:attending, true) @@ -36,22 +36,33 @@ def attend EventInvitationMailer.attending(@invitation.event, @invitation.member, @invitation).deliver_now end notice = t('messages.invitations.spot_not_confirmed') if event.surveys_required - redirect_to :back, notice: notice + redirect_back fallback_location: root_path, notice: notice else email = event.chapters.present? ? event.chapters.first.email : 'hello@codebar.io' - redirect_to :back, notice: t('messages.invitations.event.no_available_seats', email: email) + redirect_back( + fallback_location: root_path, + notice: t('messages.invitations.event.no_available_seats', email: email) + ) end end def reject - return redirect_to :back, notice: t('messages.not_attending_already') unless @invitation.attending? + unless @invitation.attending? + return redirect_back( + fallback_location: root_path, + notice: t('messages.not_attending_already') + ) + end @invitation.update_attribute(:attending, false) - redirect_to :back, notice: t('messages.rejected_invitation', name: @invitation.member.name) + redirect_back( + fallback_location: root_path, + notice: t('messages.rejected_invitation', name: @invitation.member.name) + ) end def rsvp_meeting - return redirect_to :back, notice: 'Please login first' unless logged_in? + return redirect_back fallback_location: root_path, notice: 'Please login first' unless logged_in? invitation = load_invitation meeting = invitation.meeting @@ -61,7 +72,7 @@ def rsvp_meeting redirect_to meeting_path(meeting, token: invitation.token), notice: t('messages.invitations.meeting.rsvp') else - redirect_to :back, notice: 'Sorry, something went wrong' + redirect_back fallback_location: root_path, notice: 'Sorry, something went wrong' end end @@ -70,7 +81,7 @@ def cancel_meeting @invitation.update_attribute(:attending, false) - redirect_to :back, notice: t('messages.invitations.meeting.cancel') + redirect_back fallback_location: root_path, notice: t('messages.invitations.meeting.cancel') end private diff --git a/app/controllers/mailing_lists_controller.rb b/app/controllers/mailing_lists_controller.rb index 2c1bcf5ab..ff687e672 100644 --- a/app/controllers/mailing_lists_controller.rb +++ b/app/controllers/mailing_lists_controller.rb @@ -7,13 +7,13 @@ def create subscribe_to_newsletter(current_user) flash[:notice] = I18n.t('subscriptions.messages.mailing_list.subscribe') - redirect_to :back + redirect_back fallback_location: root_path end def destroy unsubscribe_from_newsletter(current_user) flash[:notice] = I18n.t('subscriptions.messages.mailing_list.unsubscribe') - redirect_to :back + redirect_back fallback_location: root_path end end diff --git a/app/controllers/subscriptions_controller.rb b/app/controllers/subscriptions_controller.rb index 79994dc7a..6ad82ab21 100644 --- a/app/controllers/subscriptions_controller.rb +++ b/app/controllers/subscriptions_controller.rb @@ -17,7 +17,7 @@ def create else flash[:notice] = @subscription.errors.inspect end - redirect_to :back + redirect_back fallback_location: root_path end def destroy @@ -31,7 +31,7 @@ def destroy chapter: group.chapter.city, role: group.name) - redirect_to :back + redirect_back fallback_location: root_path end private diff --git a/app/controllers/super_admin/application_controller.rb b/app/controllers/super_admin/application_controller.rb index 01594faa9..acb12a057 100644 --- a/app/controllers/super_admin/application_controller.rb +++ b/app/controllers/super_admin/application_controller.rb @@ -1,5 +1,5 @@ class SuperAdmin::ApplicationController < ApplicationController - include Pundit + include Pundit::Authorization before_action :authenticate_admin! end diff --git a/app/controllers/workshops_controller.rb b/app/controllers/workshops_controller.rb index 64d5d1822..afe29a49e 100644 --- a/app/controllers/workshops_controller.rb +++ b/app/controllers/workshops_controller.rb @@ -9,13 +9,18 @@ def show end def rsvp - return redirect_to :back, notice: t('workshops.registration_not_open') unless @workshop.available_for_rsvp? + unless @workshop.available_for_rsvp? + return redirect_back( + fallback_location: root_path, + notice: t('workshops.registration_not_open') + ) + end if role_params.nil? @invitation = find_attending_invitation(@workshop, current_user) else if user_attending_or_waitlisted?(@workshop, current_user) - return redirect_to :back, notice: t('workshops.already_wish_to_attend') + return redirect_back fallback_location: root_path, notice: t('workshops.already_wish_to_attend') end @invitation = find_or_create_invitation(@workshop, current_user, role_params) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index fe7abbddf..e040fa9e0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -31,11 +31,11 @@ def member_token(member) end def twitter - Planner::Application.config.twitter + Rails.application.config.twitter end def twitter_id - Planner::Application.config.twitter_id + Rails.application.config.twitter_id end def contact_email(workshop: nil) diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb new file mode 100644 index 000000000..a009ace51 --- /dev/null +++ b/app/jobs/application_job.rb @@ -0,0 +1,2 @@ +class ApplicationJob < ActiveJob::Base +end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb new file mode 100644 index 000000000..286b2239d --- /dev/null +++ b/app/mailers/application_mailer.rb @@ -0,0 +1,4 @@ +class ApplicationMailer < ActionMailer::Base + default from: 'from@example.com' + layout 'mailer' +end diff --git a/app/mailers/contact_mailer.rb b/app/mailers/contact_mailer.rb index d82a6af7a..a51a49851 100644 --- a/app/mailers/contact_mailer.rb +++ b/app/mailers/contact_mailer.rb @@ -1,4 +1,4 @@ -class ContactMailer < ActionMailer::Base +class ContactMailer < ApplicationMailer include EmailHeaderHelper helper ApplicationHelper diff --git a/app/mailers/event_invitation_mailer.rb b/app/mailers/event_invitation_mailer.rb index 07d95d605..83c27d3b3 100644 --- a/app/mailers/event_invitation_mailer.rb +++ b/app/mailers/event_invitation_mailer.rb @@ -1,4 +1,4 @@ -class EventInvitationMailer < ActionMailer::Base +class EventInvitationMailer < ApplicationMailer include EmailHeaderHelper include ApplicationHelper diff --git a/app/mailers/feedback_request_mailer.rb b/app/mailers/feedback_request_mailer.rb index 14ede4542..921310243 100644 --- a/app/mailers/feedback_request_mailer.rb +++ b/app/mailers/feedback_request_mailer.rb @@ -1,4 +1,4 @@ -class FeedbackRequestMailer < ActionMailer::Base +class FeedbackRequestMailer < ApplicationMailer include EmailHeaderHelper helper ApplicationHelper diff --git a/app/mailers/meeting_invitation_mailer.rb b/app/mailers/meeting_invitation_mailer.rb index c8f7548cc..e6dc8f3d8 100644 --- a/app/mailers/meeting_invitation_mailer.rb +++ b/app/mailers/meeting_invitation_mailer.rb @@ -1,4 +1,4 @@ -class MeetingInvitationMailer < ActionMailer::Base +class MeetingInvitationMailer < ApplicationMailer include EmailHeaderHelper include ApplicationHelper diff --git a/app/mailers/member_mailer.rb b/app/mailers/member_mailer.rb index 9a3bc21b6..ebc5e4850 100644 --- a/app/mailers/member_mailer.rb +++ b/app/mailers/member_mailer.rb @@ -1,4 +1,4 @@ -class MemberMailer < ActionMailer::Base +class MemberMailer < ApplicationMailer include EmailHeaderHelper def welcome(member) diff --git a/app/mailers/virtual_workshop_invitation_mailer.rb b/app/mailers/virtual_workshop_invitation_mailer.rb index fd9503265..50ac4fdd3 100644 --- a/app/mailers/virtual_workshop_invitation_mailer.rb +++ b/app/mailers/virtual_workshop_invitation_mailer.rb @@ -1,4 +1,4 @@ -class VirtualWorkshopInvitationMailer < ActionMailer::Base +class VirtualWorkshopInvitationMailer < ApplicationMailer include EmailHelper include EmailHeaderHelper include ApplicationHelper diff --git a/app/mailers/workshop_invitation_mailer.rb b/app/mailers/workshop_invitation_mailer.rb index 550f44a04..9554fd1ab 100644 --- a/app/mailers/workshop_invitation_mailer.rb +++ b/app/mailers/workshop_invitation_mailer.rb @@ -1,4 +1,4 @@ -class WorkshopInvitationMailer < ActionMailer::Base +class WorkshopInvitationMailer < ApplicationMailer include EmailHelper include EmailHeaderHelper include ApplicationHelper diff --git a/app/models/address.rb b/app/models/address.rb index 1002f7185..2dd61f739 100644 --- a/app/models/address.rb +++ b/app/models/address.rb @@ -1,3 +1,3 @@ -class Address < ActiveRecord::Base +class Address < ApplicationRecord belongs_to :sponsor end diff --git a/app/models/announcement.rb b/app/models/announcement.rb index 70ae87d03..4d9ce1ba4 100644 --- a/app/models/announcement.rb +++ b/app/models/announcement.rb @@ -1,4 +1,4 @@ -class Announcement < ActiveRecord::Base +class Announcement < ApplicationRecord has_many :group_announcements has_many :groups, through: :group_announcements diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 000000000..4e703e97e --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,4 @@ +# See https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-4-2-to-rails-5-0 +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/app/models/attendance_warning.rb b/app/models/attendance_warning.rb index 144e52f17..30f395524 100644 --- a/app/models/attendance_warning.rb +++ b/app/models/attendance_warning.rb @@ -1,4 +1,4 @@ -class AttendanceWarning < ActiveRecord::Base +class AttendanceWarning < ApplicationRecord belongs_to :member belongs_to :issued_by, class_name: 'Member', foreign_key: 'sent_by_id', inverse_of: false diff --git a/app/models/auth_service.rb b/app/models/auth_service.rb index 1d466f3bd..f34e9e5ee 100644 --- a/app/models/auth_service.rb +++ b/app/models/auth_service.rb @@ -1,4 +1,4 @@ -class AuthService < ActiveRecord::Base +class AuthService < ApplicationRecord belongs_to :member validates :uid, uniqueness: { constraint: :provider } end diff --git a/app/models/ban.rb b/app/models/ban.rb index 7689f6dce..147b039a1 100644 --- a/app/models/ban.rb +++ b/app/models/ban.rb @@ -1,4 +1,4 @@ -class Ban < ActiveRecord::Base +class Ban < ApplicationRecord belongs_to :member belongs_to :added_by, class_name: 'Member' diff --git a/app/models/chapter.rb b/app/models/chapter.rb index a89f1a243..cd15547f7 100644 --- a/app/models/chapter.rb +++ b/app/models/chapter.rb @@ -1,4 +1,4 @@ -class Chapter < ActiveRecord::Base +class Chapter < ApplicationRecord resourcify :permissions, role_cname: 'Permission', role_table_name: :permission validates :name, :email, uniqueness: true, presence: true diff --git a/app/models/contact.rb b/app/models/contact.rb index def1d45a3..97c44b4cf 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -1,5 +1,5 @@ require 'services/mailing_list' -class Contact < ActiveRecord::Base +class Contact < ApplicationRecord belongs_to :sponsor validates :name, :surname, :email, presence: true diff --git a/app/models/eligibility_inquiry.rb b/app/models/eligibility_inquiry.rb index 7d98925ee..ea088e3d4 100644 --- a/app/models/eligibility_inquiry.rb +++ b/app/models/eligibility_inquiry.rb @@ -1,4 +1,4 @@ -class EligibilityInquiry < ActiveRecord::Base +class EligibilityInquiry < ApplicationRecord belongs_to :member belongs_to :issued_by, class_name: 'Member', foreign_key: 'sent_by_id', inverse_of: false diff --git a/app/models/event.rb b/app/models/event.rb index b50eacba5..e012da2f3 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -1,4 +1,4 @@ -class Event < ActiveRecord::Base +class Event < ApplicationRecord include Listable include Invitable include DateTimeConcerns diff --git a/app/models/feedback.rb b/app/models/feedback.rb index bd498fb93..57333b24b 100644 --- a/app/models/feedback.rb +++ b/app/models/feedback.rb @@ -1,4 +1,4 @@ -class Feedback < ActiveRecord::Base +class Feedback < ApplicationRecord self.per_page = 25 belongs_to :tutorial belongs_to :coach, class_name: 'Member' diff --git a/app/models/feedback_request.rb b/app/models/feedback_request.rb index 1afce45b9..392f5f0c3 100644 --- a/app/models/feedback_request.rb +++ b/app/models/feedback_request.rb @@ -1,4 +1,4 @@ -class FeedbackRequest < ActiveRecord::Base +class FeedbackRequest < ApplicationRecord belongs_to :member belongs_to :workshop diff --git a/app/models/group.rb b/app/models/group.rb index 5dc158e50..85910ae57 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,4 +1,4 @@ -class Group < ActiveRecord::Base +class Group < ApplicationRecord NAMES = %w[Coaches Students].freeze belongs_to :chapter diff --git a/app/models/group_announcement.rb b/app/models/group_announcement.rb index 063af5f5b..162bf2b71 100644 --- a/app/models/group_announcement.rb +++ b/app/models/group_announcement.rb @@ -1,4 +1,4 @@ -class GroupAnnouncement < ActiveRecord::Base +class GroupAnnouncement < ApplicationRecord belongs_to :announcement belongs_to :group end diff --git a/app/models/invitation.rb b/app/models/invitation.rb index c077c6003..cc02c02ae 100644 --- a/app/models/invitation.rb +++ b/app/models/invitation.rb @@ -1,4 +1,4 @@ -class Invitation < ActiveRecord::Base +class Invitation < ApplicationRecord include InvitationConcerns self.per_page = 20 diff --git a/app/models/meeting.rb b/app/models/meeting.rb index 4c8303a1a..7c78ccdaf 100644 --- a/app/models/meeting.rb +++ b/app/models/meeting.rb @@ -1,4 +1,4 @@ -class Meeting < ActiveRecord::Base +class Meeting < ApplicationRecord include DateTimeConcerns include Listable include Invitable diff --git a/app/models/meeting_invitation.rb b/app/models/meeting_invitation.rb index 9175dd2f2..e5f5aef8e 100644 --- a/app/models/meeting_invitation.rb +++ b/app/models/meeting_invitation.rb @@ -1,4 +1,4 @@ -class MeetingInvitation < ActiveRecord::Base +class MeetingInvitation < ApplicationRecord include InvitationConcerns belongs_to :meeting diff --git a/app/models/meeting_talk.rb b/app/models/meeting_talk.rb index f660fc1de..4ad57e2b9 100644 --- a/app/models/meeting_talk.rb +++ b/app/models/meeting_talk.rb @@ -1,4 +1,4 @@ -class MeetingTalk < ActiveRecord::Base +class MeetingTalk < ApplicationRecord belongs_to :speaker, class_name: 'Member' belongs_to :meeting diff --git a/app/models/member.rb b/app/models/member.rb index 5368bb90d..55a657150 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -1,4 +1,4 @@ -class Member < ActiveRecord::Base +class Member < ApplicationRecord include Permissions self.per_page = 80 @@ -34,7 +34,8 @@ class Member < ActiveRecord::Base .where('meeting_invitations.meeting_id = ? and meeting_invitations.attending = ?', meeting.id, true) } - scope :in_group, ->(group) { not_banned.joins(:groups).merge(group) } + scope :in_group, ->(members) { not_banned.joins(:groups).where(groups: { id: members.select(:id) }) } + scope :with_skill, ->(skill_name) { tagged_with(skill_name) } acts_as_taggable_on :skills diff --git a/app/models/member_note.rb b/app/models/member_note.rb index 054cf4145..d4c9d29fc 100644 --- a/app/models/member_note.rb +++ b/app/models/member_note.rb @@ -1,4 +1,4 @@ -class MemberNote < ActiveRecord::Base +class MemberNote < ApplicationRecord belongs_to :member belongs_to :author, class_name: 'Member' diff --git a/app/models/permission.rb b/app/models/permission.rb index e9480b0ef..1f6a7f8de 100644 --- a/app/models/permission.rb +++ b/app/models/permission.rb @@ -1,4 +1,4 @@ -class Permission < ActiveRecord::Base +class Permission < ApplicationRecord has_and_belongs_to_many :members, join_table: :members_permissions belongs_to :resource, polymorphic: true diff --git a/app/models/role.rb b/app/models/role.rb index 1b5f9ae7f..b2b7a754a 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -1,4 +1,4 @@ -class Role < ActiveRecord::Base +class Role < ApplicationRecord has_and_belongs_to_many :members scope :no_admins, -> { where.not(name: 'Admin') } diff --git a/app/models/sponsor.rb b/app/models/sponsor.rb index 72df8db49..d58e80933 100644 --- a/app/models/sponsor.rb +++ b/app/models/sponsor.rb @@ -1,4 +1,4 @@ -class Sponsor < ActiveRecord::Base +class Sponsor < ApplicationRecord include Auditor::Model self.per_page = 50 @@ -14,7 +14,7 @@ class Sponsor < ActiveRecord::Base } has_one :address - has_many :chapters, through: :workshops + has_many :contacts has_many :meetings, -> { order(date_and_time: :desc) }, foreign_key: 'venue_id', inverse_of: :venue has_many :event_sponsorships, -> { includes([:event]).joins(:event).order('events.date_and_time desc') }, @@ -27,6 +27,7 @@ class Sponsor < ActiveRecord::Base }, inverse_of: :sponsor has_many :workshops, through: :workshop_sponsors + has_many :chapters, through: :workshops accepts_nested_attributes_for :contacts, reject_if: :invalid_contact?, allow_destroy: true accepts_nested_attributes_for :address diff --git a/app/models/sponsors_search.rb b/app/models/sponsors_search.rb index e24e72da4..06996db32 100644 --- a/app/models/sponsors_search.rb +++ b/app/models/sponsors_search.rb @@ -19,7 +19,8 @@ def call private def sponsors - @sponsors ||= Sponsor.includes([:chapters]).reorder('lower(sponsors.name)').paginate(page: page) + # Get rid of unsafe SQL warning + @sponsors ||= Sponsor.includes(:chapters).reorder(Arel.sql('lower(sponsors.name)')).paginate(page: page) end def by_name diff --git a/app/models/sponsorship.rb b/app/models/sponsorship.rb index db6be5be9..eb34758ce 100644 --- a/app/models/sponsorship.rb +++ b/app/models/sponsorship.rb @@ -1,4 +1,4 @@ -class Sponsorship < ActiveRecord::Base +class Sponsorship < ApplicationRecord belongs_to :event belongs_to :sponsor end diff --git a/app/models/subscription.rb b/app/models/subscription.rb index 269f920e7..da6faa758 100644 --- a/app/models/subscription.rb +++ b/app/models/subscription.rb @@ -1,6 +1,6 @@ require 'services/mailing_list' -class Subscription < ActiveRecord::Base +class Subscription < ApplicationRecord belongs_to :group belongs_to :member has_one :chapter, through: :group diff --git a/app/models/testimonial.rb b/app/models/testimonial.rb index eedf55b96..36bc94022 100644 --- a/app/models/testimonial.rb +++ b/app/models/testimonial.rb @@ -1,3 +1,3 @@ -class Testimonial < ActiveRecord::Base +class Testimonial < ApplicationRecord belongs_to :member end diff --git a/app/models/tutorial.rb b/app/models/tutorial.rb index 92f70db1f..e3fb6e5db 100644 --- a/app/models/tutorial.rb +++ b/app/models/tutorial.rb @@ -1,4 +1,4 @@ -class Tutorial < ActiveRecord::Base +class Tutorial < ApplicationRecord belongs_to :workshop validates :title, presence: true diff --git a/app/models/waiting_list.rb b/app/models/waiting_list.rb index e55696a02..39868d135 100644 --- a/app/models/waiting_list.rb +++ b/app/models/waiting_list.rb @@ -1,4 +1,4 @@ -class WaitingList < ActiveRecord::Base +class WaitingList < ApplicationRecord belongs_to :invitation, class_name: 'WorkshopInvitation' has_one :workshop, through: :invitation diff --git a/app/models/workshop.rb b/app/models/workshop.rb index a5d98ce23..8e6249beb 100644 --- a/app/models/workshop.rb +++ b/app/models/workshop.rb @@ -1,4 +1,4 @@ -class Workshop < ActiveRecord::Base +class Workshop < ApplicationRecord include DateTimeConcerns include Invitable include Listable diff --git a/app/models/workshop_invitation.rb b/app/models/workshop_invitation.rb index 5cf0483b2..8f9d56050 100644 --- a/app/models/workshop_invitation.rb +++ b/app/models/workshop_invitation.rb @@ -1,4 +1,4 @@ -class WorkshopInvitation < ActiveRecord::Base +class WorkshopInvitation < ApplicationRecord include InvitationConcerns belongs_to :workshop diff --git a/app/models/workshop_sponsor.rb b/app/models/workshop_sponsor.rb index 19b5d304b..4c9319bcf 100644 --- a/app/models/workshop_sponsor.rb +++ b/app/models/workshop_sponsor.rb @@ -1,4 +1,4 @@ -class WorkshopSponsor < ActiveRecord::Base +class WorkshopSponsor < ApplicationRecord belongs_to :sponsor belongs_to :workshop diff --git a/app/presenters/chapter_presenter.rb b/app/presenters/chapter_presenter.rb index 2991795eb..0be623390 100644 --- a/app/presenters/chapter_presenter.rb +++ b/app/presenters/chapter_presenter.rb @@ -1,10 +1,10 @@ class ChapterPresenter < BasePresenter def twitter_id - model.twitter_id || Planner::Application.config.twitter_id + model.twitter_id || Rails.application.config.twitter_id end def twitter_handle - model.twitter || Planner::Application.config.twitter + model.twitter || Rails.application.config.twitter end def upcoming_workshops diff --git a/app/views/admin/members/_actions.html.haml b/app/views/admin/members/_actions.html.haml index 3544c303a..397327a19 100644 --- a/app/views/admin/members/_actions.html.haml +++ b/app/views/admin/members/_actions.html.haml @@ -1,6 +1,6 @@ .container-fluid.p-0 .btn-group.d-flex - = link_to '#', class: 'btn btn-primary d-block py-4 rounded-0', 'data-toggle': 'modal', 'data-target': "#note-modal" do + = link_to '#', class: 'btn btn-primary d-block py-4 rounded-0', 'data-bs-toggle': 'modal', 'data-bs-target': "#note-modal" do %i.fas.fa-pencil-alt.mr-2 Add note = link_to admin_member_send_eligibility_email_path(@member), data: {confirm: "Clicking OK will send an automated email to this user now to verify their eligibility for codebar. This cannot be undone. Are you sure?"}, class: 'btn btn-primary d-block py-4' do diff --git a/app/views/admin/members/_note.html.haml b/app/views/admin/members/_note.html.haml index 5e733758e..57e16ec9a 100644 --- a/app/views/admin/members/_note.html.haml +++ b/app/views/admin/members/_note.html.haml @@ -3,8 +3,7 @@ .modal-content .modal-header %h5.modal-title#modal-title Add a note for #{@member.full_name} - %button.close{ type: 'button', 'data-dismiss': 'modal', 'aria-label': 'Close' } - %span{ 'aria-hidden': 'true'} × + %button.btn-close{ type: 'button', 'data-bs-dismiss': 'modal', 'aria-label': 'Close' } .modal-body = simple_form_for [:admin, MemberNote.new], html: { class: 'form-inline' } do |f| = f.input :note, label: false, input_html: { rows: 3 }, placeholder: 'e.g. very enthusiastic student.' diff --git a/app/views/errors/error.html.haml b/app/views/errors/error.html.haml index b60c54457..e6413976e 100644 --- a/app/views/errors/error.html.haml +++ b/app/views/errors/error.html.haml @@ -1,4 +1,4 @@ -!!!DOCTYPE html +!!! %html %head %link{ rel: 'image_src', href: 'http://codebar.io/images/logo-square.png', :alt => "codebar logo" } diff --git a/app/views/errors/not_found.html.haml b/app/views/errors/not_found.html.haml index 83f009111..02ab1df4c 100644 --- a/app/views/errors/not_found.html.haml +++ b/app/views/errors/not_found.html.haml @@ -1,4 +1,4 @@ -!!!DOCTYPE html +!!! %html %head %link{ rel: 'image_src', href: 'http://codebar.io/images/logo-square.png', :alt => "codebar logo" } diff --git a/app/views/events/_event.html.haml b/app/views/events/_event.html.haml index 8749baf7c..97e29c6c2 100644 --- a/app/views/events/_event.html.haml +++ b/app/views/events/_event.html.haml @@ -38,4 +38,4 @@ %div - event.sponsors.each do |sponsor| = link_to sponsor.website, class: 'd-inline-block' do - = image_tag(sponsor.avatar.thumb, class: 'sponsor-sm mx-1', alt: sponsor.name) \ No newline at end of file + = image_tag(sponsor.avatar.thumb.url, class: 'sponsor-sm mx-1', alt: sponsor.name) diff --git a/app/views/invitations/show.html.haml b/app/views/invitations/show.html.haml index 51d395d62..041a3389a 100644 --- a/app/views/invitations/show.html.haml +++ b/app/views/invitations/show.html.haml @@ -73,7 +73,7 @@ .col-12.col-md-8 %address= @host_address.to_html .col-12.col-md-4 - = image_tag(@event.venue.avatar, class: 'small-image mw-100 mb-4', alt: @event.venue.name) + = image_tag(@event.venue.avatar.url, class: 'small-image mw-100 mb-4', alt: @event.venue.name) .row .col %iframe{ width: '100%', height: '250', frameborder: '0', scrolling: 'no', marginheight: '0', marginwidth: '0', src: %{https://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=#{@host_address.for_map}&ie=UTF8&t=m&z=15&output=embed} } diff --git a/app/views/layouts/_member_menu.html.haml b/app/views/layouts/_member_menu.html.haml index c0f9fbfdd..b99d7c62b 100644 --- a/app/views/layouts/_member_menu.html.haml +++ b/app/views/layouts/_member_menu.html.haml @@ -1,4 +1,4 @@ -%ul.dropdown-menu.dropdown-menu-right{'aria-labelledby': 'navbarDropdownMenuLinkMember'} +%ul.dropdown-menu.dropdown-menu-end{'aria-labelledby': 'navbarDropdownMenuLinkMember'} %li.d-none.d-lg-block %h6.dropdown-header Portal %li diff --git a/app/views/layouts/_messages.html.haml b/app/views/layouts/_messages.html.haml index 731151500..74cd2e569 100644 --- a/app/views/layouts/_messages.html.haml +++ b/app/views/layouts/_messages.html.haml @@ -4,11 +4,10 @@ - if msg.is_a?(String) .alert.alert-dismissible.fade.show.mb-0{ 'data-alert': '', class: "alert-#{name}", role: 'alert' } = content_tag :div, msg.html_safe - %button.close{ type: 'button', 'data-dismiss': 'alert', 'aria-label': 'Close' } - %span{ 'aria-hidden': 'true'} × + %button.btn-close{ type: 'button', 'data-bs-dismiss': 'alert', 'aria-label': 'Close' } - elsif msg.is_a?(Array) - msg.each do |message| .alert.alert-dismissible.fade.show.mb-0{ 'data-alert': '', class: "alert-#{name}", role: 'alert' } = content_tag :span, message.html_safe - %button.close{ type: 'button', 'data-dismiss': 'alert', 'aria-label': 'Close' } - %span{ 'aria-hidden': 'true'} × + %button.btn-close{ type: 'button', 'data-bs-dismiss': 'alert', 'aria-label': 'Close' } + diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml index caf84ffba..f43cc7b8f 100644 --- a/app/views/layouts/_navigation.html.haml +++ b/app/views/layouts/_navigation.html.haml @@ -2,18 +2,18 @@ .container = link_to root_path, class: 'navbar-brand border-0' do = image_tag('logo.png', alt: 'codebar logo', size: '200x54') - %button.navbar-toggler.mb-0{'type': 'button', 'data-toggle': 'collapse', 'data-target': '#navbarSupportedContent', 'aria-controls': 'navbarSupportedContent', 'aria-expanded': 'false', 'aria-label': 'Toggle navigation'} + %button.navbar-toggler.collapsed.mb-0{'type': 'button', 'data-bs-toggle': 'collapse', 'data-bs-target': '#navbarSupportedContent', 'aria-controls': 'navbarSupportedContent', 'aria-expanded': 'false', 'aria-label': 'Toggle navigation'} %span.navbar-toggler-icon %div.collapse.navbar-collapse.justify-content-end#navbarSupportedContent %ul.navbar-nav.ml-0 %li.nav-item.dropdown - = link_to '#', {'role': 'button', 'aria-expanded': 'false', 'data-toggle': 'dropdown', class: 'nav-link border-0 dropdown-toggle', id: 'navbarDropdownMenuLinkEvents'} do + = link_to '#', {'role': 'button', 'aria-expanded': 'false', 'data-bs-toggle': 'dropdown', class: 'nav-link border-0 dropdown-toggle', id: 'navbarDropdownMenuLinkEvents'} do Events %ul.dropdown-menu{'aria-labelledby': 'navbarDropdownMenuLinkEvents'} %li= link_to 'Events', events_path, class: 'dropdown-item' %li= link_to 'codebar Festival', 'http://festival.codebar.io/', class: 'dropdown-item' %li.nav-item.dropdown - = link_to '#', {'role': 'button', 'aria-expanded': 'false', 'data-toggle': 'dropdown', class: 'nav-link border-0 dropdown-toggle', id: 'navbarDropdownMenuLinkCommunity'} do + = link_to '#', {'role': 'button', 'aria-expanded': 'false', 'data-bs-toggle': 'dropdown', class: 'nav-link border-0 dropdown-toggle', id: 'navbarDropdownMenuLinkCommunity'} do Community %ul.dropdown-menu{'aria-labelledby': 'navbarDropdownMenuLinkCommunity'} %li= link_to 'Coaches', coaches_path, class: 'dropdown-item' @@ -40,14 +40,14 @@ - else - if current_user.is_admin? || current_user.organiser? || current_user.monthlies_organiser? %li.nav-item.dropdown - = link_to '#', {'role': 'button', 'aria-expanded': 'false', 'data-toggle': 'dropdown', class: 'nav-link border-0 dropdown-toggle', id: 'navbarDropdownMenuLinkAdmin'} do + = link_to '#', {'role': 'button', 'aria-expanded': 'false', 'data-bs-toggle': 'dropdown', class: 'nav-link border-0 dropdown-toggle', id: 'navbarDropdownMenuLinkAdmin'} do Admin - %ul.dropdown-menu.dropdown-menu-right{'aria-labelledby': 'navbarDropdownMenuLinkAdmin'} + %ul.dropdown-menu.dropdown-menu-end{'aria-labelledby': 'navbarDropdownMenuLinkAdmin'} - if current_user.is_admin? = render 'layouts/admin_menu' - elsif current_user.organiser? || current_user.monthlies_organiser? = render 'layouts/organiser_menu' %li.nav-item.dropdown - = link_to '#', {'role': 'button', 'aria-expanded': 'false', 'data-toggle': 'dropdown', class: 'nav-link border-0 dropdown-toggle', id: 'navbarDropdownMenuLinkMember'} do + = link_to '#', {'role': 'button', 'aria-expanded': 'false', 'data-bs-toggle': 'dropdown', class: 'nav-link border-0 dropdown-toggle', id: 'navbarDropdownMenuLinkMember'} do Menu = render 'layouts/member_menu' diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 8f4ff8dd3..bf7f53f7e 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -1,4 +1,4 @@ -!!!DOCTYPE html +!!! %html{ lang: 'en' } %head = render partial: 'layouts/meta' @@ -9,9 +9,9 @@ %title = retrieve_title = favicon_link_tag 'favicon.ico' - = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': true - = javascript_include_tag 'vendor/modernizr' - = javascript_include_tag 'application', 'data-turbolinks-track': true + = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' + + = javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %link{ href: 'https://fonts.googleapis.com/css?family=Open+Sans:400,300', rel:'stylesheet', type:'text/css' } %link{ href: 'https://fonts.googleapis.com/icon?family=Material+Icons', rel:'stylesheet', type:'text/css' } @@ -19,8 +19,9 @@ = content_for :head = csrf_meta_tags + = csp_meta_tag - %body.no-js{ 'class': "#{params[:controller]}-#{params[:action]}", "data-no-jquery": "true"} + %body.no-js{ 'class': "#{params[:controller]}-#{params[:action]}", "data-bs-no-jquery": "true"} #top = render partial: 'layouts/navigation' = render partial: 'layouts/messages' diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb new file mode 100644 index 000000000..cbd34d2e9 --- /dev/null +++ b/app/views/layouts/mailer.html.erb @@ -0,0 +1,13 @@ + + + + + + + + + <%= yield %> + + diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb new file mode 100644 index 000000000..37f0bddbd --- /dev/null +++ b/app/views/layouts/mailer.text.erb @@ -0,0 +1 @@ +<%= yield %> diff --git a/app/views/meetings/_meeting.html.haml b/app/views/meetings/_meeting.html.haml index a54516d9d..97fc29d18 100644 --- a/app/views/meetings/_meeting.html.haml +++ b/app/views/meetings/_meeting.html.haml @@ -37,4 +37,4 @@ - if meeting.venue.present? %div = link_to meeting.venue.website, class: 'border-0 d-inline-block' do - = image_tag(meeting.venue.avatar, class: 'sponsor-sm', alt: meeting.venue.name) + = image_tag(meeting.venue.avatar.url, class: 'sponsor-sm', alt: meeting.venue.name) diff --git a/app/views/meetings/_meeting_actions.html.haml b/app/views/meetings/_meeting_actions.html.haml index becf6ab3c..27b1ead0e 100644 --- a/app/views/meetings/_meeting_actions.html.haml +++ b/app/views/meetings/_meeting_actions.html.haml @@ -3,7 +3,7 @@ %p %strong= @meeting.venue.name = link_to @meeting.venue.website, class: 'd-block border-0 mb-4' do - = image_tag(@meeting.venue.avatar.thumb, alt: @meeting.venue.name) + = image_tag(@meeting.venue.avatar.thumb.url, alt: @meeting.venue.name) %strong Address %p= @host_address - if @host_address.directions diff --git a/app/views/members/_coach_invite_subscriptions.html.haml b/app/views/members/_coach_invite_subscriptions.html.haml index 7f9519d6e..d4bd62a8c 100644 --- a/app/views/members/_coach_invite_subscriptions.html.haml +++ b/app/views/members/_coach_invite_subscriptions.html.haml @@ -1,12 +1,12 @@ .row.justify-content-md-center.subscriptions .col-md-10.col-lg-8 - %h2.h4.toggle + %h2.h4.codebar-toggle As a Coach - if collapsed %i.fas.fa-chevron-right - else %i.fas.fa-chevron-down - .group-container{class: collapsed ? 'collapsed' : ''} + .group-container{class: collapsed ? 'codebar-collapsed' : ''} %p.lead #{link_to('Read our effective teacher guide', 'http://codebar.io/effective-teacher-guide')} - groups.each do |group| - if belongs_to_group?(group) diff --git a/app/views/members/_student_invite_subscriptions.html.haml b/app/views/members/_student_invite_subscriptions.html.haml index 9d1338dc5..6be69a489 100644 --- a/app/views/members/_student_invite_subscriptions.html.haml +++ b/app/views/members/_student_invite_subscriptions.html.haml @@ -1,12 +1,12 @@ .row.justify-content-md-center.subscriptions .col-md-10.col-lg-8 - %h2.h4.toggle + %h2.h4.codebar-toggle As a Student - if collapsed %i.fas.fa-chevron-right - else %i.fas.fa-chevron-down - .group-container{class: collapsed ? 'collapsed' : ''} + .group-container{class: collapsed ? 'codebar-collapsed' : ''} %p.lead #{link_to('Are you eligible to be a student?', 'http://codebar.io/student-guide#eligibility')} - groups.each do |group| - if belongs_to_group?(group) diff --git a/app/views/members/_testimonials.html.haml b/app/views/members/_testimonials.html.haml index 5efc21392..bd65bbcc4 100644 --- a/app/views/members/_testimonials.html.haml +++ b/app/views/members/_testimonials.html.haml @@ -1,4 +1,4 @@ -.carousel.slider{ 'data-ride': 'carousel' } +.carousel.slider{ 'data-bs-ride': 'carousel' } .carousel-inner - @testimonials.each_with_index do |testimonial, index| .carousel-item{ class: ('active' if index === 0) } diff --git a/app/views/shared/_sponsors.html.haml b/app/views/shared/_sponsors.html.haml index fc9844e36..eaddf46b9 100644 --- a/app/views/shared/_sponsors.html.haml +++ b/app/views/shared/_sponsors.html.haml @@ -1,4 +1,4 @@ .row.d-flex.align-items-center.justify-content-center - sponsors.each do |sponsor| .col-4.col-md-3.col-lg-2.mt-4.d-flex.justify-content-center - = link_to image_tag(sponsor.avatar, alt: sponsor.name, class: 'small-image mw-100'), sponsor.website, title: sponsor.name, class: 'border-0 mw-100' + = link_to image_tag(sponsor.avatar.url, alt: sponsor.name, class: 'small-image mw-100'), sponsor.website, title: sponsor.name, class: 'border-0 mw-100' diff --git a/app/views/shared_mailers/_header.html.haml b/app/views/shared_mailers/_header.html.haml index abed8e021..00c215432 100644 --- a/app/views/shared_mailers/_header.html.haml +++ b/app/views/shared_mailers/_header.html.haml @@ -1,4 +1,4 @@ -!!!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" +!!! %html{ xmlns: "http://www.w3.org/1999/xhtml" } %head %meta{name: "viewport", content: "width=device-width" } diff --git a/app/views/subscriptions/index.html.haml b/app/views/subscriptions/index.html.haml index 13e52c476..0d31fd313 100644 --- a/app/views/subscriptions/index.html.haml +++ b/app/views/subscriptions/index.html.haml @@ -31,11 +31,11 @@ %p= group.name .col.col-md-4.col-lg-3 - if belongs_to_group?(group) - = simple_form_for :subscription, method: :delete, html: { class: 'w-100' } do |f| + = simple_form_for :subscription, url: subscriptions_path, method: :delete, html: { class: 'w-100' } do |f| = f.hidden_field :subscription_id, value: nil = f.hidden_field :group_id, value: group.id = f.button :button, 'Subscribed', class: 'btn btn-success btn-lg w-100', id: "#{chapter.name.downcase}-#{group.name.downcase}" - else - = simple_form_for :subscription, html: { class: 'w-100' } do |f| + = simple_form_for :subscription, url: subscriptions_path, html: { class: 'w-100' } do |f| = f.hidden_field :group_id, value: group.id = f.button :button, 'Subscribe', class: 'btn btn-primary btn-lg w-100', id: "#{chapter.name.downcase}-#{group.name.downcase}" diff --git a/bin/bundle b/bin/bundle index 66e9889e8..f19acf5b5 100755 --- a/bin/bundle +++ b/bin/bundle @@ -1,3 +1,3 @@ #!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) load Gem.bin_path('bundler', 'bundle') diff --git a/bin/dbuild b/bin/dbuild index 31437f861..91498e9b1 100755 --- a/bin/dbuild +++ b/bin/dbuild @@ -1,5 +1,6 @@ #!/usr/bin/env bash set +e -docker-compose down -v --remove-orphans + docker-compose build -docker-compose run --rm web rake db:create db:migrate db:seed db:test:prepare +docker-compose run --rm web rake db:drop db:create db:migrate db:seed db:test:prepare +echo "Built." diff --git a/bin/dexec b/bin/dexec new file mode 100755 index 000000000..705072366 --- /dev/null +++ b/bin/dexec @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -e + +docker-compose exec web bash diff --git a/bin/drun b/bin/drun new file mode 100755 index 000000000..710fc656d --- /dev/null +++ b/bin/drun @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -e + +docker-compose exec web make serve diff --git a/bin/dstart b/bin/dstart index d2ceeb4da..251b39a11 100755 --- a/bin/dstart +++ b/bin/dstart @@ -2,18 +2,5 @@ set -e -function cleanup { - # capture exit code - code=$? - echo "cleaning up" - - # ignore errors - set +e - docker-compose down - - exit $code -} - -trap cleanup EXIT - -docker-compose up +docker-compose up -d +echo "Started." diff --git a/bin/rails b/bin/rails index 5191e6927..073966023 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path('../../config/application', __FILE__) +APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/bin/setup b/bin/setup new file mode 100755 index 000000000..94fd4d797 --- /dev/null +++ b/bin/setup @@ -0,0 +1,36 @@ +#!/usr/bin/env ruby +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = File.expand_path('..', __dir__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + # puts "\n== Copying sample files ==" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' + # end + + puts "\n== Preparing database ==" + system! 'bin/rails db:setup' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/bin/update b/bin/update new file mode 100755 index 000000000..58bfaed51 --- /dev/null +++ b/bin/update @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = File.expand_path('..', __dir__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/bin/yarn b/bin/yarn new file mode 100755 index 000000000..460dd565b --- /dev/null +++ b/bin/yarn @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +APP_ROOT = File.expand_path('..', __dir__) +Dir.chdir(APP_ROOT) do + begin + exec "yarnpkg", *ARGV + rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end +end diff --git a/config/application.rb b/config/application.rb index 190b7d0eb..caf0101aa 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,18 +1,32 @@ -require File.expand_path('../boot', __FILE__) +require_relative 'boot' +require "rails" # Pick the frameworks you want: -require 'active_record/railtie' -require 'action_controller/railtie' -require 'action_mailer/railtie' -require 'sprockets/railtie' -# require "rails/test_unit/railtie" +require "active_model/railtie" +require "active_job/railtie" +require "active_record/railtie" +require "active_storage/engine" +require "action_controller/railtie" +require "action_mailer/railtie" +require "action_view/railtie" +# require "action_cable/engine" +require "sprockets/railtie" +require "rails/test_unit/railtie" # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. -Bundler.require(:default, Rails.env) +Bundler.require(*Rails.groups) module Planner class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 5.0 + + # Settings in config/environments/* take precedence over those specified here. + # Application configuration can go into files in config/initializers + # -- all .rb files in that directory are automatically loaded after loading + # the framework and any gems in your application. + # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. @@ -21,11 +35,21 @@ class Application < Rails::Application # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. config.time_zone = 'London' config.active_record.default_timezone = :local - config.active_record.raise_in_transactional_callbacks = true + + # Remove config.active_record.raise_in_transactional_callbacks, which is deprecated and removed without replacement, see + # https://apidock.com/rails/v5.0.0.1/ActiveRecord/Transactions/ClassMethods/raise_in_transactional_callbacks%3D. + # config.active_record.raise_in_transactional_callbacks = true + # Related to https://stackoverflow.com/questions/72970170/upgrading-to-rails-6-1-6-1-causes-psychdisallowedclass-tried-to-load-unspecif + # and https://discuss.rubyonrails.org/t/cve-2022-32224-possible-rce-escalation-bug-with-serialized-columns-in-active-record/81017 + config.active_record.yaml_column_permitted_classes = [Symbol, Date, Time, ActiveSupport::TimeWithZone, ActiveSupport::TimeZone, ActiveSupport::HashWithIndifferentAccess] # Allow Skylight to show insights from local development. # More info at https://skylight.io/support/environments config.skylight.environments << 'development' + + # TODO: sort this out properly at + # See https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#active-record-belongs-to-required-by-default-option + config.active_record.belongs_to_required_by_default = false end end diff --git a/config/boot.rb b/config/boot.rb index 5e5f0c1fa..b9e460cef 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,4 @@ -# Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' # Set up gems listed in the Gemfile. +require 'bootsnap/setup' # Speed up boot time by caching expensive operations. diff --git a/config/environment.rb b/config/environment.rb index 32d00062f..426333bb4 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ # Load the Rails application. -require File.expand_path('../application', __FILE__) +require_relative 'application' # Initialize the Rails application. -Planner::Application.initialize! +Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index c97338dbf..753f7e512 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,4 +1,4 @@ -Planner::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on @@ -9,11 +9,26 @@ # Do not eager load code on boot. config.eager_load = false - config.action_mailer.default_url_options = { host: 'localhost:3000' } + # Show full error reports. + config.consider_all_requests_local = true + + # Enable/disable caching. By default caching is disabled. + # Run rails dev:cache to toggle caching. + if Rails.root.join('tmp', 'caching-dev.txt').exist? + config.action_controller.perform_caching = true - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{2.days.to_i}" + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end + + # Store uploaded files on the local file system (see config/storage.yml for options) + config.active_storage.service = :local # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false @@ -22,18 +37,39 @@ # 'handle_asynchronously' in the controller. # config.action_mailer.delivery_method = :letter_opener + config.action_mailer.perform_caching = false + # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log - # Raise an error on page load if there are pending migrations + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load + # Highlight code that triggered database queries in logs. + config.active_record.verbose_query_logs = true + # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true - config.logger = Logger.new(STDOUT) + # Suppress logger output for asset requests. + config.assets.quiet = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true + + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + config.file_watcher = ActiveSupport::EventedFileUpdateChecker + + + config.action_mailer.default_url_options = { host: 'localhost:3000' } + + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + config.log_level = :debug config.after_initialize do diff --git a/config/environments/production.rb b/config/environments/production.rb index 853c1a89a..8c1e6ad64 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,11 +1,11 @@ -Planner::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both thread web servers + # your application in memory, allowing both threaded web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true @@ -14,52 +14,89 @@ config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Enable Rack::Cache to put a simple HTTP cache in front of your application - # Add `rack-cache` to your Gemfile before enabling this. - # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. - # config.action_dispatch.rack_cache = true + # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] + # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). + # config.require_master_key = true - # Disable Rails's static asset server (Apache or nginx will already do this). - config.serve_static_files = false + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. - config.assets.js_compressor = Uglifier.new(harmony: true) + config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # Generate digests for assets URLs. - config.assets.digest = true + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb - # Version of your assets, change this if you want to expire all your assets. - config.assets.version = '1.0' + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Store uploaded files on the local file system (see config/storage.yml for options) + config.active_storage.service = :local # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true - # Set to :debug to see everything in the log. + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. config.log_level = :info # Prepend all log lines with the following tags. - # config.log_tags = [ :subdomain, :uuid ] - - # Use a different logger for distributed setups. - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + config.log_tags = [ :request_id ] # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = "http://assets.example.com" + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "planner_#{Rails.env}" - # Precompile additional assets. - # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. - # config.assets.precompile += %w( search.js ) + config.action_mailer.perform_caching = false + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false + + # Enable Rack::Cache to put a simple HTTP cache in front of your application + # Add `rack-cache` to your Gemfile before enabling this. + # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. + # config.action_dispatch.rack_cache = true + + # Disable Rails's static asset server (Apache or nginx will already do this). + config.serve_static_files = false + + # Generate digests for assets URLs. + config.assets.digest = true config.action_mailer.default_url_options = { host: 'codebar.io' } @@ -77,17 +114,4 @@ enable_starttls_auto: true } ActionMailer::Base.delivery_method = :smtp - - # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found). - config.i18n.fallbacks = true - - # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify - - # Disable automatic flushing of the log to improve performance. - # config.autoflush_log = false - - # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new end diff --git a/config/environments/test.rb b/config/environments/test.rb index 418a2c6d7..65ca00f63 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,4 +1,4 @@ -Planner::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's @@ -7,15 +7,16 @@ # and recreated between test runs. Don't rely on the data there! config.cache_classes = true - config.action_mailer.default_url_options = { host: 'localhost:3000' } # Do not eager load code on boot. This avoids loading your whole application # just for the purpose of running a single test. If you are using a tool that # preloads Rails for running tests, you may have to set it to true. config.eager_load = false - # Configure static asset server for tests with Cache-Control for performance. - config.serve_static_files = true - config.static_cache_control = 'public, max-age=3600' + # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.enabled = true + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{1.hour.to_i}" + } # Show full error reports and disable caching. config.consider_all_requests_local = true @@ -27,6 +28,11 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + # Store uploaded files on the local file system in a temporary directory + config.active_storage.service = :test + + config.action_mailer.perform_caching = false + # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. @@ -35,12 +41,23 @@ # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true + + config.action_mailer.default_url_options = { host: 'localhost:3000' } + + + # Configure static asset server for tests with Cache-Control for performance. + config.serve_static_files = true + config.static_cache_control = 'public, max-age=3600' + # Fake omniauth for testing OmniAuth.config.test_mode = true config.after_initialize do + # TODO: re-enable and go through failures Bullet.enable = true Bullet.bullet_logger = true - Bullet.raise = true # raise an error if n+1 query occurs + Bullet.raise = false # raise an error if n+1 query occurs end end diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb new file mode 100644 index 000000000..89d2efab2 --- /dev/null +++ b/config/initializers/application_controller_renderer.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# ActiveSupport::Reloader.to_prepare do +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) +# end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 0a3366aae..bbacf241d 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1 +1,17 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Add additional assets to the asset load path. +# Rails.application.config.assets.paths << Emoji.images_path +# Add Yarn node_modules folder to the asset load path. +Rails.application.config.assets.paths << Rails.root.join('node_modules') + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in the app/assets +# folder are already added. +# Rails.application.config.assets.precompile += %w( admin.js admin.css ) +# TODO: consider moving as per upgrade guidance +# https://github.com/rails/sprockets/blob/main/UPGRADING.md#manifestjs Rails.application.config.assets.precompile += %w(payments.js) diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb new file mode 100644 index 000000000..d3bcaa5ec --- /dev/null +++ b/config/initializers/content_security_policy.rb @@ -0,0 +1,25 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide content security policy +# For further information see the following documentation +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy + +# Rails.application.config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https + +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end + +# If you are using UJS then enable automatic nonce generation +# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } + +# Report CSP violations to a specified URI +# For further information see the following documentation: +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only +# Rails.application.config.content_security_policy_report_only = true diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb new file mode 100644 index 000000000..1389e86a3 --- /dev/null +++ b/config/initializers/cookies_serializer.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. +Rails.application.config.action_dispatch.cookies_serializer = :marshal diff --git a/config/initializers/haml_markdown.rb b/config/initializers/haml_markdown.rb index 01f79833f..14f52b97b 100644 --- a/config/initializers/haml_markdown.rb +++ b/config/initializers/haml_markdown.rb @@ -1,11 +1,14 @@ -module Haml::Filters - remove_filter("Markdown") #remove the existing Markdown filter +# Remove the haml_markdown initaliser. The internals changed so the monkey-patching to implement a custom render method +# no longer works, but is also not necessary since the markdown filter uses CommonMarker anyway. - module Markdown - include Haml::Filters::Base +# module Haml::Filters +# remove_filter("Markdown") #remove the existing Markdown filter - def render(text) - CommonMarker.render_html(text, :DEFAULT).html_safe - end - end -end +# module Markdown +# include Haml::Filters::Base + +# def render(text) +# CommonMarker.render_html(text, :DEFAULT).html_safe +# end +# end +# end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index 72aca7e44..dc1899682 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -2,4 +2,3 @@ # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone diff --git a/config/initializers/new_framework_defaults_5_2.rb b/config/initializers/new_framework_defaults_5_2.rb new file mode 100644 index 000000000..c383d072b --- /dev/null +++ b/config/initializers/new_framework_defaults_5_2.rb @@ -0,0 +1,38 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.2 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Make Active Record use stable #cache_key alongside new #cache_version method. +# This is needed for recyclable cache keys. +# Rails.application.config.active_record.cache_versioning = true + +# Use AES-256-GCM authenticated encryption for encrypted cookies. +# Also, embed cookie expiry in signed or encrypted cookies for increased security. +# +# This option is not backwards compatible with earlier Rails versions. +# It's best enabled when your entire app is migrated and stable on 5.2. +# +# Existing cookies will be converted on read then written with the new scheme. +# Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true + +# Use AES-256-GCM authenticated encryption as default cipher for encrypting messages +# instead of AES-256-CBC, when use_authenticated_message_encryption is set to true. +# Rails.application.config.active_support.use_authenticated_message_encryption = true + +# Add default protection from forgery to ActionController::Base instead of in +# ApplicationController. +# Rails.application.config.action_controller.default_protect_from_forgery = true + +# Store boolean values are in sqlite3 databases as 1 and 0 instead of 't' and +# 'f' after migrating old data. +# Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true + +# Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header. +# Rails.application.config.active_support.use_sha1_digests = true + +# Make `form_with` generate id attributes for any generated HTML tags. +# Rails.application.config.action_view.form_with_generates_ids = true diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index dba519852..bc9047660 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -1,5 +1,5 @@ -key, token = ENV['PLANNER_SECRET'], ENV['PLANNER_KEY_BASE'] -key, token = 'sample-key', 'sample-token' if Rails.env.development? || Rails.env.test? +key = ENV['PLANNER_SECRET'] +key = 'sample-key' if Rails.env.development? || Rails.env.test? + +Rails.application.config.secret_key_base = key -Planner::Application.config.secret_key_base = key -Planner::Application.config.secret_token = token diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index 7f2039c7b..89d4fc250 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,4 +1,4 @@ # Be sure to restart your server when you modify this file. -Planner::Application.config.session_store :cookie_store, key: '_planner_session', +Rails.application.config.session_store :cookie_store, key: '_planner_session', expire_after: 24.hours diff --git a/config/initializers/twitter.rb b/config/initializers/twitter.rb index 1c4b6f28c..44c646736 100644 --- a/config/initializers/twitter.rb +++ b/config/initializers/twitter.rb @@ -1,2 +1,2 @@ -Planner::Application.config.twitter = ENV['HQ_TWITTER_HANDLE'] -Planner::Application.config.twitter_id = ENV['HQ_TWITTER_ID'] +Rails.application.config.twitter = ENV['HQ_TWITTER_HANDLE'] +Rails.application.config.twitter_id = ENV['HQ_TWITTER_ID'] diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index 33725e95f..bbfc3961b 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -5,10 +5,10 @@ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] if respond_to?(:wrap_parameters) + wrap_parameters format: [:json] end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true +# self.include_root_in_json = true # end diff --git a/config/locales/en.yml b/config/locales/en.yml index e1caffcad..213aec60a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,3 +1,34 @@ +# Files in the config/locales directory are used for internationalization +# and are automatically loaded by Rails. If you want to use locales other +# than English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t 'hello' +# +# In views, this is aliased to just `t`: +# +# <%= t('hello') %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# The following keys must be escaped otherwise they will not be retrieved by +# the default I18n backend: +# +# true, false, on, off, yes, no +# +# Instead, surround them with single quotes. +# +# en: +# 'true': 'foo' +# +# To learn more, please read the Rails Internationalization guide +# available at http://guides.rubyonrails.org/i18n.html. + en: brand: "codebar.io" date: @@ -809,3 +840,4 @@ en: text: "Benevity is a platform enabling corporate social responsibility and employee engagement. We receive a donation from your employer with every hour you volunteer with us." services: donations: https://codebar.enthuse.com/donate/#!/ + diff --git a/config/puma.rb b/config/puma.rb index d4f3ac2f0..70d1aa503 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,11 +1,41 @@ -workers Integer(ENV['PUMA_WORKERS'] || 3) -threads Integer(ENV['MIN_THREADS'] || 1), Integer(ENV['MAX_THREADS'] || 5) +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers: a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum; this matches the default thread size of Active Record. +# +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } +threads threads_count, threads_count +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +# +port ENV.fetch("PORT") { 3000 } + +# Specifies the `environment` that Puma will run in. +# +environment ENV.fetch('RAILS_ENV') { ENV.fetch('RACK_ENV') { "development" } } + +# Specifies the `pidfile` that Puma will use. +pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } + +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked webserver processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +workers ENV.fetch('WEB_CONCURRENCY') { ENV.fetch('PUMA_WORKERS') { 3 } } +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. +# preload_app! -rackup DefaultRackup -port ENV['PORT'] || 3000 -environment ENV['RACK_ENV'] || 'development' +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart + +rackup DefaultRackup if defined?(DefaultRackup) raise_exception_on_sigterm false on_worker_boot do diff --git a/config/routes.rb b/config/routes.rb index abc9fcd87..2fd36e753 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,5 @@ -Planner::Application.routes.draw do +Rails.application.routes.draw do + # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html root 'dashboard#show' scope controller: 'dashboard' do diff --git a/config/spring.rb b/config/spring.rb new file mode 100644 index 000000000..9fa7863f9 --- /dev/null +++ b/config/spring.rb @@ -0,0 +1,6 @@ +%w[ + .ruby-version + .rbenv-vars + tmp/restart.txt + tmp/caching-dev.txt +].each { |path| Spring.watch(path) } diff --git a/config/storage.yml b/config/storage.yml new file mode 100644 index 000000000..d32f76e8f --- /dev/null +++ b/config/storage.yml @@ -0,0 +1,34 @@ +test: + service: Disk + root: <%= Rails.root.join("tmp/storage") %> + +local: + service: Disk + root: <%= Rails.root.join("storage") %> + +# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) +# amazon: +# service: S3 +# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> +# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> +# region: us-east-1 +# bucket: your_own_bucket + +# Remember not to checkin your GCS keyfile to a repository +# google: +# service: GCS +# project: your_project +# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> +# bucket: your_own_bucket + +# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) +# microsoft: +# service: AzureStorage +# storage_account_name: your_account_name +# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> +# container: your_container_name + +# mirror: +# service: Mirror +# primary: local +# mirrors: [ amazon, google, microsoft ] diff --git a/db/migrate/20131017221407_create_members.rb b/db/migrate/20131017221407_create_members.rb index d1f9703c3..c80ef8c49 100644 --- a/db/migrate/20131017221407_create_members.rb +++ b/db/migrate/20131017221407_create_members.rb @@ -1,4 +1,4 @@ -class CreateMembers < ActiveRecord::Migration +class CreateMembers < ActiveRecord::Migration[4.2] def change create_table :members do |t| t.string :name diff --git a/db/migrate/20131020223957_create_sessions.rb b/db/migrate/20131020223957_create_sessions.rb index abc86181d..00ce941ac 100644 --- a/db/migrate/20131020223957_create_sessions.rb +++ b/db/migrate/20131020223957_create_sessions.rb @@ -1,4 +1,4 @@ -class CreateSessions < ActiveRecord::Migration +class CreateSessions < ActiveRecord::Migration[4.2] def change create_table :sessions do |t| t.string :title diff --git a/db/migrate/20131020235644_create_invitations.rb b/db/migrate/20131020235644_create_invitations.rb index f47a5fb75..1766ef0b0 100644 --- a/db/migrate/20131020235644_create_invitations.rb +++ b/db/migrate/20131020235644_create_invitations.rb @@ -1,4 +1,4 @@ -class CreateInvitations < ActiveRecord::Migration +class CreateInvitations < ActiveRecord::Migration[4.2] def change create_table :invitations do |t| t.references :sessions, index: true diff --git a/db/migrate/20131021011352_add_token_to_invitation.rb b/db/migrate/20131021011352_add_token_to_invitation.rb index c1066cc71..b94d80df4 100644 --- a/db/migrate/20131021011352_add_token_to_invitation.rb +++ b/db/migrate/20131021011352_add_token_to_invitation.rb @@ -1,4 +1,4 @@ -class AddTokenToInvitation < ActiveRecord::Migration +class AddTokenToInvitation < ActiveRecord::Migration[4.2] def change add_column :invitations, :token, :string end diff --git a/db/migrate/20131021011859_add_index_to_invitation_token.rb b/db/migrate/20131021011859_add_index_to_invitation_token.rb index 3c156a10f..c4778733c 100644 --- a/db/migrate/20131021011859_add_index_to_invitation_token.rb +++ b/db/migrate/20131021011859_add_index_to_invitation_token.rb @@ -1,4 +1,4 @@ -class AddIndexToInvitationToken < ActiveRecord::Migration +class AddIndexToInvitationToken < ActiveRecord::Migration[4.2] def change add_index :invitations, :token, unique: true end diff --git a/db/migrate/20131021040356_add_unsubscribed_to_member.rb b/db/migrate/20131021040356_add_unsubscribed_to_member.rb index ee229afd0..6b7cdfc68 100644 --- a/db/migrate/20131021040356_add_unsubscribed_to_member.rb +++ b/db/migrate/20131021040356_add_unsubscribed_to_member.rb @@ -1,4 +1,4 @@ -class AddUnsubscribedToMember < ActiveRecord::Migration +class AddUnsubscribedToMember < ActiveRecord::Migration[4.2] def change add_column :members, :unsubscribed, :boolean end diff --git a/db/migrate/20131021182241_add_seats_to_session.rb b/db/migrate/20131021182241_add_seats_to_session.rb index 2a4b0b6aa..84399871e 100644 --- a/db/migrate/20131021182241_add_seats_to_session.rb +++ b/db/migrate/20131021182241_add_seats_to_session.rb @@ -1,4 +1,4 @@ -class AddSeatsToSession < ActiveRecord::Migration +class AddSeatsToSession < ActiveRecord::Migration[4.2] def change add_column :sessions, :seats, :integer, default: 15 end diff --git a/db/migrate/20131024223507_create_roles.rb b/db/migrate/20131024223507_create_roles.rb index 5d97a3b17..c83931d13 100644 --- a/db/migrate/20131024223507_create_roles.rb +++ b/db/migrate/20131024223507_create_roles.rb @@ -1,4 +1,4 @@ -class CreateRoles < ActiveRecord::Migration +class CreateRoles < ActiveRecord::Migration[4.2] def change create_table :roles do |t| t.string :name diff --git a/db/migrate/20131024224307_create_member_role.rb b/db/migrate/20131024224307_create_member_role.rb index 4b5f0a6d7..a53563148 100644 --- a/db/migrate/20131024224307_create_member_role.rb +++ b/db/migrate/20131024224307_create_member_role.rb @@ -1,4 +1,4 @@ -class CreateMemberRole < ActiveRecord::Migration +class CreateMemberRole < ActiveRecord::Migration[4.2] def change create_table :members_roles, id: false do |t| t.references :member diff --git a/db/migrate/20131029210620_create_courses.rb b/db/migrate/20131029210620_create_courses.rb index fecd1c20b..8b31168d5 100644 --- a/db/migrate/20131029210620_create_courses.rb +++ b/db/migrate/20131029210620_create_courses.rb @@ -1,4 +1,4 @@ -class CreateCourses < ActiveRecord::Migration +class CreateCourses < ActiveRecord::Migration[4.2] def change create_table :courses do |t| t.string :title diff --git a/db/migrate/20131102132756_create_sponsors.rb b/db/migrate/20131102132756_create_sponsors.rb index ec6986aa4..d8d67b966 100644 --- a/db/migrate/20131102132756_create_sponsors.rb +++ b/db/migrate/20131102132756_create_sponsors.rb @@ -1,4 +1,4 @@ -class CreateSponsors < ActiveRecord::Migration +class CreateSponsors < ActiveRecord::Migration[4.2] def change create_table :sponsors do |t| t.string :name diff --git a/db/migrate/20131102141049_create_address.rb b/db/migrate/20131102141049_create_address.rb index 1f9f3c8a2..215e92f8a 100644 --- a/db/migrate/20131102141049_create_address.rb +++ b/db/migrate/20131102141049_create_address.rb @@ -1,4 +1,4 @@ -class CreateAddress < ActiveRecord::Migration +class CreateAddress < ActiveRecord::Migration[4.2] def change create_table :addresses do |t| t.string :flat diff --git a/db/migrate/20131103174325_create_sponsor_sessions.rb b/db/migrate/20131103174325_create_sponsor_sessions.rb index 187b3e3e8..18b40c14d 100644 --- a/db/migrate/20131103174325_create_sponsor_sessions.rb +++ b/db/migrate/20131103174325_create_sponsor_sessions.rb @@ -1,4 +1,4 @@ -class CreateSponsorSessions < ActiveRecord::Migration +class CreateSponsorSessions < ActiveRecord::Migration[4.2] def change create_table :sponsor_sessions do |t| t.belongs_to :sponsor, index: true diff --git a/db/migrate/20131103210723_rename_invitations_to_session_invitations.rb b/db/migrate/20131103210723_rename_invitations_to_session_invitations.rb index 5abc41176..a3585b749 100644 --- a/db/migrate/20131103210723_rename_invitations_to_session_invitations.rb +++ b/db/migrate/20131103210723_rename_invitations_to_session_invitations.rb @@ -1,4 +1,4 @@ -class RenameInvitationsToSessionInvitations < ActiveRecord::Migration +class RenameInvitationsToSessionInvitations < ActiveRecord::Migration[4.2] def change rename_table :invitations, :session_invitations end diff --git a/db/migrate/20131103212835_create_course_invitations.rb b/db/migrate/20131103212835_create_course_invitations.rb index 81cdf39d7..2fee5c720 100644 --- a/db/migrate/20131103212835_create_course_invitations.rb +++ b/db/migrate/20131103212835_create_course_invitations.rb @@ -1,4 +1,4 @@ -class CreateCourseInvitations < ActiveRecord::Migration +class CreateCourseInvitations < ActiveRecord::Migration[4.2] def change create_table :course_invitations do |t| t.references :course, index: true diff --git a/db/migrate/20131104030726_create_reminders.rb b/db/migrate/20131104030726_create_reminders.rb index d155a8997..fae4db8f3 100644 --- a/db/migrate/20131104030726_create_reminders.rb +++ b/db/migrate/20131104030726_create_reminders.rb @@ -1,4 +1,4 @@ -class CreateReminders < ActiveRecord::Migration +class CreateReminders < ActiveRecord::Migration[4.2] def change create_table :reminders do |t| t.string :reminder_type diff --git a/db/migrate/20131107182457_add_avatar_to_sponsor.rb b/db/migrate/20131107182457_add_avatar_to_sponsor.rb index 39953f142..e91e86fbd 100644 --- a/db/migrate/20131107182457_add_avatar_to_sponsor.rb +++ b/db/migrate/20131107182457_add_avatar_to_sponsor.rb @@ -1,4 +1,4 @@ -class AddAvatarToSponsor < ActiveRecord::Migration +class AddAvatarToSponsor < ActiveRecord::Migration[4.2] def change add_column :sponsors, :avatar, :string end diff --git a/db/migrate/20131110220757_add_website_to_sponsor.rb b/db/migrate/20131110220757_add_website_to_sponsor.rb index 17726b63c..5694c5001 100644 --- a/db/migrate/20131110220757_add_website_to_sponsor.rb +++ b/db/migrate/20131110220757_add_website_to_sponsor.rb @@ -1,4 +1,4 @@ -class AddWebsiteToSponsor < ActiveRecord::Migration +class AddWebsiteToSponsor < ActiveRecord::Migration[4.2] def change add_column :sponsors, :website, :string end diff --git a/db/migrate/20131111024701_add_role_to_session_invitations.rb b/db/migrate/20131111024701_add_role_to_session_invitations.rb index 665893866..df04f5fe6 100644 --- a/db/migrate/20131111024701_add_role_to_session_invitations.rb +++ b/db/migrate/20131111024701_add_role_to_session_invitations.rb @@ -1,4 +1,4 @@ -class AddRoleToSessionInvitations < ActiveRecord::Migration +class AddRoleToSessionInvitations < ActiveRecord::Migration[4.2] def change add_column :session_invitations, :role, :string end diff --git a/db/migrate/20131112221451_remove_seats_from_sessions.rb b/db/migrate/20131112221451_remove_seats_from_sessions.rb index abc6a52e4..c82e16bee 100644 --- a/db/migrate/20131112221451_remove_seats_from_sessions.rb +++ b/db/migrate/20131112221451_remove_seats_from_sessions.rb @@ -1,4 +1,4 @@ -class RemoveSeatsFromSessions < ActiveRecord::Migration +class RemoveSeatsFromSessions < ActiveRecord::Migration[4.2] def change remove_column :sessions, :seats, :integer end diff --git a/db/migrate/20131112221641_add_seats_to_sponsor.rb b/db/migrate/20131112221641_add_seats_to_sponsor.rb index 8ba06f6c5..d685df8cb 100644 --- a/db/migrate/20131112221641_add_seats_to_sponsor.rb +++ b/db/migrate/20131112221641_add_seats_to_sponsor.rb @@ -1,4 +1,4 @@ -class AddSeatsToSponsor < ActiveRecord::Migration +class AddSeatsToSponsor < ActiveRecord::Migration[4.2] def change add_column :sponsors, :seats, :integer, default: 15 end diff --git a/db/migrate/20131130211001_create_tutorials.rb b/db/migrate/20131130211001_create_tutorials.rb index ce3386977..2ef261892 100644 --- a/db/migrate/20131130211001_create_tutorials.rb +++ b/db/migrate/20131130211001_create_tutorials.rb @@ -1,4 +1,4 @@ -class CreateTutorials < ActiveRecord::Migration +class CreateTutorials < ActiveRecord::Migration[4.2] def change create_table :tutorials do |t| t.string :name diff --git a/db/migrate/20131130211305_create_feedbacks.rb b/db/migrate/20131130211305_create_feedbacks.rb index b28d5c315..f0da347cc 100644 --- a/db/migrate/20131130211305_create_feedbacks.rb +++ b/db/migrate/20131130211305_create_feedbacks.rb @@ -1,4 +1,4 @@ -class CreateFeedbacks < ActiveRecord::Migration +class CreateFeedbacks < ActiveRecord::Migration[4.2] def change create_table :feedbacks do |t| t.references :tutorial, index: true diff --git a/db/migrate/20131201091346_rename_tutorials_table_name_column_to_title.rb b/db/migrate/20131201091346_rename_tutorials_table_name_column_to_title.rb index 84c181a24..e46745e30 100644 --- a/db/migrate/20131201091346_rename_tutorials_table_name_column_to_title.rb +++ b/db/migrate/20131201091346_rename_tutorials_table_name_column_to_title.rb @@ -1,4 +1,4 @@ -class RenameTutorialsTableNameColumnToTitle < ActiveRecord::Migration +class RenameTutorialsTableNameColumnToTitle < ActiveRecord::Migration[4.2] def change rename_column :tutorials, :name, :title end diff --git a/db/migrate/20131208030221_create_meetings.rb b/db/migrate/20131208030221_create_meetings.rb index d0a2096d9..d1a997b5e 100644 --- a/db/migrate/20131208030221_create_meetings.rb +++ b/db/migrate/20131208030221_create_meetings.rb @@ -1,4 +1,4 @@ -class CreateMeetings < ActiveRecord::Migration +class CreateMeetings < ActiveRecord::Migration[4.2] def change create_table :meetings do |t| t.datetime :date_and_time diff --git a/db/migrate/20131208030336_create_meeting_talks.rb b/db/migrate/20131208030336_create_meeting_talks.rb index 5250afc44..84c61a7a3 100644 --- a/db/migrate/20131208030336_create_meeting_talks.rb +++ b/db/migrate/20131208030336_create_meeting_talks.rb @@ -1,4 +1,4 @@ -class CreateMeetingTalks < ActiveRecord::Migration +class CreateMeetingTalks < ActiveRecord::Migration[4.2] def change create_table :meeting_talks do |t| t.references :meeting, index: true diff --git a/db/migrate/20131208141447_create_auth_services.rb b/db/migrate/20131208141447_create_auth_services.rb index 3c56c3382..54f3bcdce 100644 --- a/db/migrate/20131208141447_create_auth_services.rb +++ b/db/migrate/20131208141447_create_auth_services.rb @@ -1,4 +1,4 @@ -class CreateAuthServices < ActiveRecord::Migration +class CreateAuthServices < ActiveRecord::Migration[4.2] def change create_table :auth_services do |t| t.references :member, index: true diff --git a/db/migrate/20131208145950_add_can_log_in_to_users.rb b/db/migrate/20131208145950_add_can_log_in_to_users.rb index d99d7765e..69b7aa14a 100644 --- a/db/migrate/20131208145950_add_can_log_in_to_users.rb +++ b/db/migrate/20131208145950_add_can_log_in_to_users.rb @@ -1,4 +1,4 @@ -class AddCanLogInToUsers < ActiveRecord::Migration +class AddCanLogInToUsers < ActiveRecord::Migration[4.2] def change add_column :members, :can_log_in, :boolean, null: false, default: false end diff --git a/db/migrate/20131221204400_add_token_to_feedbacks.rb b/db/migrate/20131221204400_add_token_to_feedbacks.rb index 3b40cf470..985f065ba 100644 --- a/db/migrate/20131221204400_add_token_to_feedbacks.rb +++ b/db/migrate/20131221204400_add_token_to_feedbacks.rb @@ -1,4 +1,4 @@ -class AddTokenToFeedbacks < ActiveRecord::Migration +class AddTokenToFeedbacks < ActiveRecord::Migration[4.2] def change add_column :feedbacks, :token, :string add_index :feedbacks, :token, unique: true diff --git a/db/migrate/20131222160002_add_rating_to_feedbacks.rb b/db/migrate/20131222160002_add_rating_to_feedbacks.rb index 1cd1153b4..ff2fd272f 100644 --- a/db/migrate/20131222160002_add_rating_to_feedbacks.rb +++ b/db/migrate/20131222160002_add_rating_to_feedbacks.rb @@ -1,4 +1,4 @@ -class AddRatingToFeedbacks < ActiveRecord::Migration +class AddRatingToFeedbacks < ActiveRecord::Migration[4.2] def change add_column :feedbacks, :rating, :integer end diff --git a/db/migrate/20140119093708_create_feedback_requests.rb b/db/migrate/20140119093708_create_feedback_requests.rb index 5303363c6..80fd5aa4d 100644 --- a/db/migrate/20140119093708_create_feedback_requests.rb +++ b/db/migrate/20140119093708_create_feedback_requests.rb @@ -1,4 +1,4 @@ -class CreateFeedbackRequests < ActiveRecord::Migration +class CreateFeedbackRequests < ActiveRecord::Migration[4.2] def change create_table :feedback_requests do |t| t.references :member, index: true diff --git a/db/migrate/20140202112853_remove_token_from_feedbacks.rb b/db/migrate/20140202112853_remove_token_from_feedbacks.rb index 27c6e429e..43e0fa61d 100644 --- a/db/migrate/20140202112853_remove_token_from_feedbacks.rb +++ b/db/migrate/20140202112853_remove_token_from_feedbacks.rb @@ -1,4 +1,4 @@ -class RemoveTokenFromFeedbacks < ActiveRecord::Migration +class RemoveTokenFromFeedbacks < ActiveRecord::Migration[4.2] def change remove_column :feedbacks, :token, :string end diff --git a/db/migrate/20140329201235_add_phone_number_to_members.rb b/db/migrate/20140329201235_add_phone_number_to_members.rb index 07cb8e9c5..98c72148c 100644 --- a/db/migrate/20140329201235_add_phone_number_to_members.rb +++ b/db/migrate/20140329201235_add_phone_number_to_members.rb @@ -1,4 +1,4 @@ -class AddPhoneNumberToMembers < ActiveRecord::Migration +class AddPhoneNumberToMembers < ActiveRecord::Migration[4.2] def change add_column :members, :mobile, :string end diff --git a/db/migrate/20140403004924_create_course_tutors.rb b/db/migrate/20140403004924_create_course_tutors.rb index d33ccfb9c..c9415a021 100644 --- a/db/migrate/20140403004924_create_course_tutors.rb +++ b/db/migrate/20140403004924_create_course_tutors.rb @@ -1,4 +1,4 @@ -class CreateCourseTutors < ActiveRecord::Migration +class CreateCourseTutors < ActiveRecord::Migration[4.2] def change create_table :course_tutors do |t| t.belongs_to :course, index: true diff --git a/db/migrate/20140417151614_add_name_to_meeting.rb b/db/migrate/20140417151614_add_name_to_meeting.rb index 53cf30018..ba7ffe3c5 100644 --- a/db/migrate/20140417151614_add_name_to_meeting.rb +++ b/db/migrate/20140417151614_add_name_to_meeting.rb @@ -1,4 +1,4 @@ -class AddNameToMeeting < ActiveRecord::Migration +class AddNameToMeeting < ActiveRecord::Migration[4.2] def change add_column :meetings, :name, :string end diff --git a/db/migrate/20140417152406_add_description_to_meeting.rb b/db/migrate/20140417152406_add_description_to_meeting.rb index 8519effb9..84ad19631 100644 --- a/db/migrate/20140417152406_add_description_to_meeting.rb +++ b/db/migrate/20140417152406_add_description_to_meeting.rb @@ -1,4 +1,4 @@ -class AddDescriptionToMeeting < ActiveRecord::Migration +class AddDescriptionToMeeting < ActiveRecord::Migration[4.2] def change add_column :meetings, :description, :string end diff --git a/db/migrate/20140417154809_add_slug_to_meeting.rb b/db/migrate/20140417154809_add_slug_to_meeting.rb index 4031aa3ae..99c64d192 100644 --- a/db/migrate/20140417154809_add_slug_to_meeting.rb +++ b/db/migrate/20140417154809_add_slug_to_meeting.rb @@ -1,4 +1,4 @@ -class AddSlugToMeeting < ActiveRecord::Migration +class AddSlugToMeeting < ActiveRecord::Migration[4.2] def change add_column :meetings, :slug, :string end diff --git a/db/migrate/20140425155706_add_host_to_course.rb b/db/migrate/20140425155706_add_host_to_course.rb index fa339869a..9f3535371 100644 --- a/db/migrate/20140425155706_add_host_to_course.rb +++ b/db/migrate/20140425155706_add_host_to_course.rb @@ -1,4 +1,4 @@ -class AddHostToCourse < ActiveRecord::Migration +class AddHostToCourse < ActiveRecord::Migration[4.2] def change add_reference :courses, :sponsor, index: true end diff --git a/db/migrate/20140425160722_add_ticket_url_to_course.rb b/db/migrate/20140425160722_add_ticket_url_to_course.rb index fb8f4c957..12468fd38 100644 --- a/db/migrate/20140425160722_add_ticket_url_to_course.rb +++ b/db/migrate/20140425160722_add_ticket_url_to_course.rb @@ -1,4 +1,4 @@ -class AddTicketUrlToCourse < ActiveRecord::Migration +class AddTicketUrlToCourse < ActiveRecord::Migration[4.2] def change add_column :courses, :ticket_url, :string end diff --git a/db/migrate/20140501015844_add_verified_to_member.rb b/db/migrate/20140501015844_add_verified_to_member.rb index 2e0ac5d48..b22b19f34 100644 --- a/db/migrate/20140501015844_add_verified_to_member.rb +++ b/db/migrate/20140501015844_add_verified_to_member.rb @@ -1,4 +1,4 @@ -class AddVerifiedToMember < ActiveRecord::Migration +class AddVerifiedToMember < ActiveRecord::Migration[4.2] def change add_column :members, :verified, :boolean end diff --git a/db/migrate/20140504143819_create_job.rb b/db/migrate/20140504143819_create_job.rb index 91fdb7504..cebed96ea 100644 --- a/db/migrate/20140504143819_create_job.rb +++ b/db/migrate/20140504143819_create_job.rb @@ -1,4 +1,4 @@ -class CreateJob < ActiveRecord::Migration +class CreateJob < ActiveRecord::Migration[4.2] def change create_table :jobs do |t| t.string :title diff --git a/db/migrate/20140504171455_add_company_to_job.rb b/db/migrate/20140504171455_add_company_to_job.rb index 7b1372927..d1f93ee52 100644 --- a/db/migrate/20140504171455_add_company_to_job.rb +++ b/db/migrate/20140504171455_add_company_to_job.rb @@ -1,4 +1,4 @@ -class AddCompanyToJob < ActiveRecord::Migration +class AddCompanyToJob < ActiveRecord::Migration[4.2] def change add_column :jobs, :company, :string end diff --git a/db/migrate/20140510232842_add_invitable_to_session.rb b/db/migrate/20140510232842_add_invitable_to_session.rb index cc0a88941..6fd0d3a89 100644 --- a/db/migrate/20140510232842_add_invitable_to_session.rb +++ b/db/migrate/20140510232842_add_invitable_to_session.rb @@ -1,4 +1,4 @@ -class AddInvitableToSession < ActiveRecord::Migration +class AddInvitableToSession < ActiveRecord::Migration[4.2] def change add_column :sessions, :invitable, :boolean, default: true add_column :sessions, :sign_up_url, :string diff --git a/db/migrate/20140510234035_add_city_to_address.rb b/db/migrate/20140510234035_add_city_to_address.rb index c4b71883d..6489a30fb 100644 --- a/db/migrate/20140510234035_add_city_to_address.rb +++ b/db/migrate/20140510234035_add_city_to_address.rb @@ -1,4 +1,4 @@ -class AddCityToAddress < ActiveRecord::Migration +class AddCityToAddress < ActiveRecord::Migration[4.2] def change add_column :addresses, :city, :string end diff --git a/db/migrate/20140610130020_create_chapters.rb b/db/migrate/20140610130020_create_chapters.rb index 87985b037..e98cbe313 100644 --- a/db/migrate/20140610130020_create_chapters.rb +++ b/db/migrate/20140610130020_create_chapters.rb @@ -1,4 +1,4 @@ -class CreateChapters < ActiveRecord::Migration +class CreateChapters < ActiveRecord::Migration[4.2] def change create_table :chapters do |t| t.string :name diff --git a/db/migrate/20140610133755_create_groups.rb b/db/migrate/20140610133755_create_groups.rb index 1ad896b16..4b340cff0 100644 --- a/db/migrate/20140610133755_create_groups.rb +++ b/db/migrate/20140610133755_create_groups.rb @@ -1,4 +1,4 @@ -class CreateGroups < ActiveRecord::Migration +class CreateGroups < ActiveRecord::Migration[4.2] def change create_table :groups do |t| t.references :chapter, index: true diff --git a/db/migrate/20140610155915_create_subscriptions.rb b/db/migrate/20140610155915_create_subscriptions.rb index d9f6fccbf..afe4ec5a0 100644 --- a/db/migrate/20140610155915_create_subscriptions.rb +++ b/db/migrate/20140610155915_create_subscriptions.rb @@ -1,4 +1,4 @@ -class CreateSubscriptions < ActiveRecord::Migration +class CreateSubscriptions < ActiveRecord::Migration[4.2] def change create_table :subscriptions do |t| t.references :group, index: true diff --git a/db/migrate/20140610202421_add_chapter_to_session.rb b/db/migrate/20140610202421_add_chapter_to_session.rb index dc68397b4..fcb8d2407 100644 --- a/db/migrate/20140610202421_add_chapter_to_session.rb +++ b/db/migrate/20140610202421_add_chapter_to_session.rb @@ -1,4 +1,4 @@ -class AddChapterToSession < ActiveRecord::Migration +class AddChapterToSession < ActiveRecord::Migration[4.2] def change add_reference :sessions, :chapter, index: true end diff --git a/db/migrate/20140610212001_add_time_to_sessions.rb b/db/migrate/20140610212001_add_time_to_sessions.rb index 6e5591462..cc7e93f1c 100644 --- a/db/migrate/20140610212001_add_time_to_sessions.rb +++ b/db/migrate/20140610212001_add_time_to_sessions.rb @@ -1,4 +1,4 @@ -class AddTimeToSessions < ActiveRecord::Migration +class AddTimeToSessions < ActiveRecord::Migration[4.2] def change add_column :sessions, :time, :datetime end diff --git a/db/migrate/20140611191143_rolify_create_permissions.rb b/db/migrate/20140611191143_rolify_create_permissions.rb index 819ae922f..999503504 100644 --- a/db/migrate/20140611191143_rolify_create_permissions.rb +++ b/db/migrate/20140611191143_rolify_create_permissions.rb @@ -1,4 +1,4 @@ -class RolifyCreatePermissions < ActiveRecord::Migration +class RolifyCreatePermissions < ActiveRecord::Migration[4.2] def change create_table(:permissions) do |t| t.string :name diff --git a/db/migrate/20140615010338_add_chapter_to_course.rb b/db/migrate/20140615010338_add_chapter_to_course.rb index 185776405..2696c2cab 100644 --- a/db/migrate/20140615010338_add_chapter_to_course.rb +++ b/db/migrate/20140615010338_add_chapter_to_course.rb @@ -1,4 +1,4 @@ -class AddChapterToCourse < ActiveRecord::Migration +class AddChapterToCourse < ActiveRecord::Migration[4.2] def change add_reference :courses, :chapter, index: true end diff --git a/db/migrate/20140615030540_add_avatar_cache_to_sponsor.rb b/db/migrate/20140615030540_add_avatar_cache_to_sponsor.rb index 5fa6cd31d..8ac652713 100644 --- a/db/migrate/20140615030540_add_avatar_cache_to_sponsor.rb +++ b/db/migrate/20140615030540_add_avatar_cache_to_sponsor.rb @@ -1,4 +1,4 @@ -class AddAvatarCacheToSponsor < ActiveRecord::Migration +class AddAvatarCacheToSponsor < ActiveRecord::Migration[4.2] def change add_column :sponsors, :image_cache, :string end diff --git a/db/migrate/20140621234319_add_email_to_chapter.rb b/db/migrate/20140621234319_add_email_to_chapter.rb index 87a37fa33..4dee4fb5a 100644 --- a/db/migrate/20140621234319_add_email_to_chapter.rb +++ b/db/migrate/20140621234319_add_email_to_chapter.rb @@ -1,4 +1,4 @@ -class AddEmailToChapter < ActiveRecord::Migration +class AddEmailToChapter < ActiveRecord::Migration[4.2] def change add_column :chapters, :email, :string end diff --git a/db/migrate/20140708114919_add_number_of_coaches_to_sponsor.rb b/db/migrate/20140708114919_add_number_of_coaches_to_sponsor.rb index afcd6e8f1..45d4280f0 100644 --- a/db/migrate/20140708114919_add_number_of_coaches_to_sponsor.rb +++ b/db/migrate/20140708114919_add_number_of_coaches_to_sponsor.rb @@ -1,4 +1,4 @@ -class AddNumberOfCoachesToSponsor < ActiveRecord::Migration +class AddNumberOfCoachesToSponsor < ActiveRecord::Migration[4.2] def change add_column :sponsors, :number_of_coaches, :integer, default: nil end diff --git a/db/migrate/20140824234126_drop_reminders.rb b/db/migrate/20140824234126_drop_reminders.rb index 335aa6be5..72b7efb22 100644 --- a/db/migrate/20140824234126_drop_reminders.rb +++ b/db/migrate/20140824234126_drop_reminders.rb @@ -1,4 +1,4 @@ -class DropReminders < ActiveRecord::Migration +class DropReminders < ActiveRecord::Migration[4.2] def change drop_table :reminders end diff --git a/db/migrate/20140825005743_add_reminder_at_to_session_invitations.rb b/db/migrate/20140825005743_add_reminder_at_to_session_invitations.rb index 13bd73322..3ae774aa4 100644 --- a/db/migrate/20140825005743_add_reminder_at_to_session_invitations.rb +++ b/db/migrate/20140825005743_add_reminder_at_to_session_invitations.rb @@ -1,4 +1,4 @@ -class AddReminderAtToSessionInvitations < ActiveRecord::Migration +class AddReminderAtToSessionInvitations < ActiveRecord::Migration[4.2] def change add_column :session_invitations, :reminded_at, :datetime, default: nil end diff --git a/db/migrate/20140828194906_create_waiting_lists.rb b/db/migrate/20140828194906_create_waiting_lists.rb index d61913f0c..242e26715 100644 --- a/db/migrate/20140828194906_create_waiting_lists.rb +++ b/db/migrate/20140828194906_create_waiting_lists.rb @@ -1,4 +1,4 @@ -class CreateWaitingLists < ActiveRecord::Migration +class CreateWaitingLists < ActiveRecord::Migration[4.2] def change create_table :waiting_lists do |t| t.references :invitation, index: true diff --git a/db/migrate/20140908151822_add_twitter_handle_and_id_to_chapter.rb b/db/migrate/20140908151822_add_twitter_handle_and_id_to_chapter.rb index 57ad48799..83e6807f4 100644 --- a/db/migrate/20140908151822_add_twitter_handle_and_id_to_chapter.rb +++ b/db/migrate/20140908151822_add_twitter_handle_and_id_to_chapter.rb @@ -1,4 +1,4 @@ -class AddTwitterHandleAndIdToChapter < ActiveRecord::Migration +class AddTwitterHandleAndIdToChapter < ActiveRecord::Migration[4.2] def change add_column :chapters, :twitter, :string add_column :chapters, :twitter_id, :string diff --git a/db/migrate/20140916134752_remove_verified_from_user.rb b/db/migrate/20140916134752_remove_verified_from_user.rb index 3f1100545..52cda6279 100644 --- a/db/migrate/20140916134752_remove_verified_from_user.rb +++ b/db/migrate/20140916134752_remove_verified_from_user.rb @@ -1,4 +1,4 @@ -class RemoveVerifiedFromUser < ActiveRecord::Migration +class RemoveVerifiedFromUser < ActiveRecord::Migration[4.2] def change remove_column :members, :verified end diff --git a/db/migrate/20141003172945_create_testimonials.rb b/db/migrate/20141003172945_create_testimonials.rb index ee50b4d72..3999f8463 100644 --- a/db/migrate/20141003172945_create_testimonials.rb +++ b/db/migrate/20141003172945_create_testimonials.rb @@ -1,4 +1,4 @@ -class CreateTestimonials < ActiveRecord::Migration +class CreateTestimonials < ActiveRecord::Migration[4.2] def change create_table :testimonials do |t| t.references :member, index: true diff --git a/db/migrate/20141003195205_change_testimonial_string_to_text.rb b/db/migrate/20141003195205_change_testimonial_string_to_text.rb index f2993642e..fcabe1f88 100644 --- a/db/migrate/20141003195205_change_testimonial_string_to_text.rb +++ b/db/migrate/20141003195205_change_testimonial_string_to_text.rb @@ -1,4 +1,4 @@ -class ChangeTestimonialStringToText < ActiveRecord::Migration +class ChangeTestimonialStringToText < ActiveRecord::Migration[4.2] def change change_column :testimonials, :text, :text end diff --git a/db/migrate/20141022052135_add_welcome_fields_to_member.rb b/db/migrate/20141022052135_add_welcome_fields_to_member.rb index 4b7ef9d7f..8993c94cd 100644 --- a/db/migrate/20141022052135_add_welcome_fields_to_member.rb +++ b/db/migrate/20141022052135_add_welcome_fields_to_member.rb @@ -1,4 +1,4 @@ -class AddWelcomeFieldsToMember < ActiveRecord::Migration +class AddWelcomeFieldsToMember < ActiveRecord::Migration[4.2] def change add_column :members, :received_coach_welcome_email, :boolean, default: false add_column :members, :received_student_welcome_email, :boolean, default: false diff --git a/db/migrate/20141203000909_create_events.rb b/db/migrate/20141203000909_create_events.rb index a1c76da8b..0567aa547 100644 --- a/db/migrate/20141203000909_create_events.rb +++ b/db/migrate/20141203000909_create_events.rb @@ -1,4 +1,4 @@ -class CreateEvents < ActiveRecord::Migration +class CreateEvents < ActiveRecord::Migration[4.2] def change create_table :events do |t| t.string :name diff --git a/db/migrate/20141203004824_create_sponsorships.rb b/db/migrate/20141203004824_create_sponsorships.rb index 294ee30db..e9d1f1727 100644 --- a/db/migrate/20141203004824_create_sponsorships.rb +++ b/db/migrate/20141203004824_create_sponsorships.rb @@ -1,4 +1,4 @@ -class CreateSponsorships < ActiveRecord::Migration +class CreateSponsorships < ActiveRecord::Migration[4.2] def change create_table :sponsorships do |t| t.references :event, index: true diff --git a/db/migrate/20141203012421_add_slug_to_event.rb b/db/migrate/20141203012421_add_slug_to_event.rb index dd79be960..c8849cada 100644 --- a/db/migrate/20141203012421_add_slug_to_event.rb +++ b/db/migrate/20141203012421_add_slug_to_event.rb @@ -1,4 +1,4 @@ -class AddSlugToEvent < ActiveRecord::Migration +class AddSlugToEvent < ActiveRecord::Migration[4.2] def change add_column :events, :slug, :string end diff --git a/db/migrate/20141203034740_add_schedule_to_event.rb b/db/migrate/20141203034740_add_schedule_to_event.rb index 35a0b16b2..88d7fdf31 100644 --- a/db/migrate/20141203034740_add_schedule_to_event.rb +++ b/db/migrate/20141203034740_add_schedule_to_event.rb @@ -1,4 +1,4 @@ -class AddScheduleToEvent < ActiveRecord::Migration +class AddScheduleToEvent < ActiveRecord::Migration[4.2] def change add_column :events, :schedule, :text end diff --git a/db/migrate/20141204011642_create_invitations_2.rb b/db/migrate/20141204011642_create_invitations_2.rb index adb3c925a..7bc4d8a7c 100644 --- a/db/migrate/20141204011642_create_invitations_2.rb +++ b/db/migrate/20141204011642_create_invitations_2.rb @@ -1,4 +1,4 @@ -class CreateInvitations2 < ActiveRecord::Migration +class CreateInvitations2 < ActiveRecord::Migration[4.2] def change create_table :invitations do |t| t.references :event, index: true diff --git a/db/migrate/20141204164936_add_token_to_invitation_2.rb b/db/migrate/20141204164936_add_token_to_invitation_2.rb index a656c1def..42fe284fc 100644 --- a/db/migrate/20141204164936_add_token_to_invitation_2.rb +++ b/db/migrate/20141204164936_add_token_to_invitation_2.rb @@ -1,4 +1,4 @@ -class AddTokenToInvitation2 < ActiveRecord::Migration +class AddTokenToInvitation2 < ActiveRecord::Migration[4.2] def change add_column :invitations, :token, :string end diff --git a/db/migrate/20141204173228_add_student_and_coach_spaces_to_event.rb b/db/migrate/20141204173228_add_student_and_coach_spaces_to_event.rb index acee975f7..0d4bfc113 100644 --- a/db/migrate/20141204173228_add_student_and_coach_spaces_to_event.rb +++ b/db/migrate/20141204173228_add_student_and_coach_spaces_to_event.rb @@ -1,4 +1,4 @@ -class AddStudentAndCoachSpacesToEvent < ActiveRecord::Migration +class AddStudentAndCoachSpacesToEvent < ActiveRecord::Migration[4.2] def change add_column :events, :coach_spaces, :integer add_column :events, :student_spaces, :integer diff --git a/db/migrate/20141204181137_add_coach_and_student_questionnaire_to_event.rb b/db/migrate/20141204181137_add_coach_and_student_questionnaire_to_event.rb index f2fab4b27..9f0581ca0 100644 --- a/db/migrate/20141204181137_add_coach_and_student_questionnaire_to_event.rb +++ b/db/migrate/20141204181137_add_coach_and_student_questionnaire_to_event.rb @@ -1,4 +1,4 @@ -class AddCoachAndStudentQuestionnaireToEvent < ActiveRecord::Migration +class AddCoachAndStudentQuestionnaireToEvent < ActiveRecord::Migration[4.2] def change add_column :events, :coach_questionnaire, :string add_column :events, :student_questionnaire, :string diff --git a/db/migrate/20141204181517_add_verified_and_verified_by_to_invitation.rb b/db/migrate/20141204181517_add_verified_and_verified_by_to_invitation.rb index 06c89d5ea..4067db463 100644 --- a/db/migrate/20141204181517_add_verified_and_verified_by_to_invitation.rb +++ b/db/migrate/20141204181517_add_verified_and_verified_by_to_invitation.rb @@ -1,4 +1,4 @@ -class AddVerifiedAndVerifiedByToInvitation < ActiveRecord::Migration +class AddVerifiedAndVerifiedByToInvitation < ActiveRecord::Migration[4.2] def change add_column :invitations, :verified, :boolean add_reference :invitations, :verified_by, index: true diff --git a/db/migrate/20141204221303_add_coach_description_to_event.rb b/db/migrate/20141204221303_add_coach_description_to_event.rb index 7703cb9d0..fc0b089fa 100644 --- a/db/migrate/20141204221303_add_coach_description_to_event.rb +++ b/db/migrate/20141204221303_add_coach_description_to_event.rb @@ -1,4 +1,4 @@ -class AddCoachDescriptionToEvent < ActiveRecord::Migration +class AddCoachDescriptionToEvent < ActiveRecord::Migration[4.2] def change add_column :events, :coach_description, :text end diff --git a/db/migrate/20141204232033_add_info_to_event.rb b/db/migrate/20141204232033_add_info_to_event.rb index 7264643ef..fd69f6a27 100644 --- a/db/migrate/20141204232033_add_info_to_event.rb +++ b/db/migrate/20141204232033_add_info_to_event.rb @@ -1,4 +1,4 @@ -class AddInfoToEvent < ActiveRecord::Migration +class AddInfoToEvent < ActiveRecord::Migration[4.2] def change add_column :events, :info, :string end diff --git a/db/migrate/20150130001852_create_member_notes.rb b/db/migrate/20150130001852_create_member_notes.rb index a0742860d..003c4af86 100644 --- a/db/migrate/20150130001852_create_member_notes.rb +++ b/db/migrate/20150130001852_create_member_notes.rb @@ -1,4 +1,4 @@ -class CreateMemberNotes < ActiveRecord::Migration +class CreateMemberNotes < ActiveRecord::Migration[4.2] def change create_table :member_notes do |t| t.references :member, index: true diff --git a/db/migrate/20150211023345_add_rsvp_close_time_to_sessions.rb b/db/migrate/20150211023345_add_rsvp_close_time_to_sessions.rb index 49ee4f8b5..c7c457d4e 100644 --- a/db/migrate/20150211023345_add_rsvp_close_time_to_sessions.rb +++ b/db/migrate/20150211023345_add_rsvp_close_time_to_sessions.rb @@ -1,4 +1,4 @@ -class AddRsvpCloseTimeToSessions < ActiveRecord::Migration +class AddRsvpCloseTimeToSessions < ActiveRecord::Migration[4.2] def change add_column :sessions, :rsvp_close_time, :datetime end diff --git a/db/migrate/20150219223111_add_slug_to_chapter.rb b/db/migrate/20150219223111_add_slug_to_chapter.rb index 864c7818a..fd3487c5e 100644 --- a/db/migrate/20150219223111_add_slug_to_chapter.rb +++ b/db/migrate/20150219223111_add_slug_to_chapter.rb @@ -1,4 +1,4 @@ -class AddSlugToChapter < ActiveRecord::Migration +class AddSlugToChapter < ActiveRecord::Migration[4.2] def change add_column :chapters, :slug, :string end diff --git a/db/migrate/20150222110321_add_announce_only_to_event.rb b/db/migrate/20150222110321_add_announce_only_to_event.rb index 92d4e92a5..8957f0536 100644 --- a/db/migrate/20150222110321_add_announce_only_to_event.rb +++ b/db/migrate/20150222110321_add_announce_only_to_event.rb @@ -1,4 +1,4 @@ -class AddAnnounceOnlyToEvent < ActiveRecord::Migration +class AddAnnounceOnlyToEvent < ActiveRecord::Migration[4.2] def change add_column :events, :announce_only, :boolean, defaults: false add_column :events, :url, :string, defaults: nil diff --git a/db/migrate/20150224001247_add_mailing_list_id_to_group.rb b/db/migrate/20150224001247_add_mailing_list_id_to_group.rb index 63def7db1..4f785824e 100644 --- a/db/migrate/20150224001247_add_mailing_list_id_to_group.rb +++ b/db/migrate/20150224001247_add_mailing_list_id_to_group.rb @@ -1,4 +1,4 @@ -class AddMailingListIdToGroup < ActiveRecord::Migration +class AddMailingListIdToGroup < ActiveRecord::Migration[4.2] def change add_column :groups, :mailing_list_id, :string end diff --git a/db/migrate/20150328102113_add_invitable_to_event.rb b/db/migrate/20150328102113_add_invitable_to_event.rb index e1446a55e..a1745835d 100644 --- a/db/migrate/20150328102113_add_invitable_to_event.rb +++ b/db/migrate/20150328102113_add_invitable_to_event.rb @@ -1,4 +1,4 @@ -class AddInvitableToEvent < ActiveRecord::Migration +class AddInvitableToEvent < ActiveRecord::Migration[4.2] def change add_column :events, :invitable, :boolean, default: false end diff --git a/db/migrate/20150409140851_create_announcements.rb b/db/migrate/20150409140851_create_announcements.rb index 3d425212e..4fd5b9a0e 100644 --- a/db/migrate/20150409140851_create_announcements.rb +++ b/db/migrate/20150409140851_create_announcements.rb @@ -1,4 +1,4 @@ -class CreateAnnouncements < ActiveRecord::Migration +class CreateAnnouncements < ActiveRecord::Migration[4.2] def change create_table :announcements do |t| t.datetime :expires_at diff --git a/db/migrate/20150409145541_create_group_announcements.rb b/db/migrate/20150409145541_create_group_announcements.rb index bc8fc2ebe..35603de43 100644 --- a/db/migrate/20150409145541_create_group_announcements.rb +++ b/db/migrate/20150409145541_create_group_announcements.rb @@ -1,4 +1,4 @@ -class CreateGroupAnnouncements < ActiveRecord::Migration +class CreateGroupAnnouncements < ActiveRecord::Migration[4.2] def change create_table :group_announcements do |t| t.references :announcement, index: true diff --git a/db/migrate/20150418235316_create_bans.rb b/db/migrate/20150418235316_create_bans.rb index 00fd3516e..9b53f9399 100644 --- a/db/migrate/20150418235316_create_bans.rb +++ b/db/migrate/20150418235316_create_bans.rb @@ -1,4 +1,4 @@ -class CreateBans < ActiveRecord::Migration +class CreateBans < ActiveRecord::Migration[4.2] def change create_table :bans do |t| t.references :member, index: true diff --git a/db/migrate/20150419004358_create_delayed_jobs.rb b/db/migrate/20150419004358_create_delayed_jobs.rb index 7ecd2e11a..b9c0d388a 100644 --- a/db/migrate/20150419004358_create_delayed_jobs.rb +++ b/db/migrate/20150419004358_create_delayed_jobs.rb @@ -1,4 +1,4 @@ -class CreateDelayedJobs < ActiveRecord::Migration +class CreateDelayedJobs < ActiveRecord::Migration[4.2] def self.up create_table :delayed_jobs, force: true do |table| table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue diff --git a/db/migrate/20150505133258_add_tito_url_to_event.rb b/db/migrate/20150505133258_add_tito_url_to_event.rb index 3f5b6e963..8a788e5e7 100644 --- a/db/migrate/20150505133258_add_tito_url_to_event.rb +++ b/db/migrate/20150505133258_add_tito_url_to_event.rb @@ -1,4 +1,4 @@ -class AddTitoUrlToEvent < ActiveRecord::Migration +class AddTitoUrlToEvent < ActiveRecord::Migration[4.2] def change add_column :events, :tito_url, :string end diff --git a/db/migrate/20150505161414_create_chapters_events.rb b/db/migrate/20150505161414_create_chapters_events.rb index cc9a915f2..7b3b915a7 100644 --- a/db/migrate/20150505161414_create_chapters_events.rb +++ b/db/migrate/20150505161414_create_chapters_events.rb @@ -1,4 +1,4 @@ -class CreateChaptersEvents < ActiveRecord::Migration +class CreateChaptersEvents < ActiveRecord::Migration[4.2] def change create_table :chapters_events do |t| t.integer :chapter_id, index: true diff --git a/db/migrate/20150508211109_add_contacts_to_sponsors.rb b/db/migrate/20150508211109_add_contacts_to_sponsors.rb index 88cd2b053..19bf3b7c6 100644 --- a/db/migrate/20150508211109_add_contacts_to_sponsors.rb +++ b/db/migrate/20150508211109_add_contacts_to_sponsors.rb @@ -1,4 +1,4 @@ -class AddContactsToSponsors < ActiveRecord::Migration +class AddContactsToSponsors < ActiveRecord::Migration[4.2] def change add_column :sponsors, :email, :string add_column :sponsors, :contact_first_name, :string diff --git a/db/migrate/20150509200835_create_contacts.rb b/db/migrate/20150509200835_create_contacts.rb index c3a99202b..3387f83b7 100644 --- a/db/migrate/20150509200835_create_contacts.rb +++ b/db/migrate/20150509200835_create_contacts.rb @@ -1,4 +1,4 @@ -class CreateContacts < ActiveRecord::Migration +class CreateContacts < ActiveRecord::Migration[4.2] def change create_table :contacts do |t| t.references :sponsor, index: true diff --git a/db/migrate/20150629202748_create_eligibility_inquiries.rb b/db/migrate/20150629202748_create_eligibility_inquiries.rb index da335cc93..8440b79e9 100644 --- a/db/migrate/20150629202748_create_eligibility_inquiries.rb +++ b/db/migrate/20150629202748_create_eligibility_inquiries.rb @@ -1,4 +1,4 @@ -class CreateEligibilityInquiries < ActiveRecord::Migration +class CreateEligibilityInquiries < ActiveRecord::Migration[4.2] def change create_table :eligibility_inquiries do |t| t.references :member, index: true diff --git a/db/migrate/20150714194446_create_attendance_warnings.rb b/db/migrate/20150714194446_create_attendance_warnings.rb index 8a46e1d4f..ac190b086 100644 --- a/db/migrate/20150714194446_create_attendance_warnings.rb +++ b/db/migrate/20150714194446_create_attendance_warnings.rb @@ -1,4 +1,4 @@ -class CreateAttendanceWarnings < ActiveRecord::Migration +class CreateAttendanceWarnings < ActiveRecord::Migration[4.2] def change create_table :attendance_warnings do |t| t.references :member, index: true diff --git a/db/migrate/20150725165534_create_member_contacts.rb b/db/migrate/20150725165534_create_member_contacts.rb index f0a6e6f96..7385f7be3 100644 --- a/db/migrate/20150725165534_create_member_contacts.rb +++ b/db/migrate/20150725165534_create_member_contacts.rb @@ -1,4 +1,4 @@ -class CreateMemberContacts < ActiveRecord::Migration +class CreateMemberContacts < ActiveRecord::Migration[4.2] def change create_table :member_contacts do |t| t.integer :sponsor_id diff --git a/db/migrate/20150801134457_add_map_coords_to_address.rb b/db/migrate/20150801134457_add_map_coords_to_address.rb index e1227ca8a..c1b127472 100644 --- a/db/migrate/20150801134457_add_map_coords_to_address.rb +++ b/db/migrate/20150801134457_add_map_coords_to_address.rb @@ -1,4 +1,4 @@ -class AddMapCoordsToAddress < ActiveRecord::Migration +class AddMapCoordsToAddress < ActiveRecord::Migration[4.2] def change add_column :addresses, :latitude, :string add_column :addresses, :longitude, :string diff --git a/db/migrate/20150814042120_add_show_faq_to_events.rb b/db/migrate/20150814042120_add_show_faq_to_events.rb index 184624aec..18ea2dae5 100644 --- a/db/migrate/20150814042120_add_show_faq_to_events.rb +++ b/db/migrate/20150814042120_add_show_faq_to_events.rb @@ -1,4 +1,4 @@ -class AddShowFaqToEvents < ActiveRecord::Migration +class AddShowFaqToEvents < ActiveRecord::Migration[4.2] def change add_column :events, :show_faq, :boolean end diff --git a/db/migrate/20150823215449_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20150823215449_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb index de1422fc2..0501a1e78 100644 --- a/db/migrate/20150823215449_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150823215449_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 1) -class ActsAsTaggableOnMigration < ActiveRecord::Migration +class ActsAsTaggableOnMigration < ActiveRecord::Migration[4.2] def self.up create_table :tags do |t| t.string :name diff --git a/db/migrate/20150823215450_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20150823215450_add_missing_unique_indices.acts_as_taggable_on_engine.rb index cf9150230..cc285a790 100644 --- a/db/migrate/20150823215450_add_missing_unique_indices.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150823215450_add_missing_unique_indices.acts_as_taggable_on_engine.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 2) -class AddMissingUniqueIndices < ActiveRecord::Migration +class AddMissingUniqueIndices < ActiveRecord::Migration[4.2] def self.up add_index :tags, :name, unique: true diff --git a/db/migrate/20150823215451_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20150823215451_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb index 8edb50807..5a3f71a25 100644 --- a/db/migrate/20150823215451_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150823215451_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 3) -class AddTaggingsCounterCacheToTags < ActiveRecord::Migration +class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[4.2] def self.up add_column :tags, :taggings_count, :integer, default: 0 diff --git a/db/migrate/20150823215452_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20150823215452_add_missing_taggable_index.acts_as_taggable_on_engine.rb index d841559c0..d0e77107b 100644 --- a/db/migrate/20150823215452_add_missing_taggable_index.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150823215452_add_missing_taggable_index.acts_as_taggable_on_engine.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 4) -class AddMissingTaggableIndex < ActiveRecord::Migration +class AddMissingTaggableIndex < ActiveRecord::Migration[4.2] def self.up add_index :taggings, %i[taggable_id taggable_type context] end diff --git a/db/migrate/20150823215453_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20150823215453_change_collation_for_tag_names.acts_as_taggable_on_engine.rb index 0af8b5e9f..2cbcdb1ca 100644 --- a/db/migrate/20150823215453_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150823215453_change_collation_for_tag_names.acts_as_taggable_on_engine.rb @@ -1,7 +1,7 @@ # This migration comes from acts_as_taggable_on_engine (originally 5) # This migration is added to circumvent issue #623 and have special characters # work properly -class ChangeCollationForTagNames < ActiveRecord::Migration +class ChangeCollationForTagNames < ActiveRecord::Migration[4.2] def up if ActsAsTaggableOn::Utils.using_mysql? execute('ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;') diff --git a/db/migrate/20151110180108_add_togglable_fields_to_event.rb b/db/migrate/20151110180108_add_togglable_fields_to_event.rb index 9bdcc0910..f49251e68 100644 --- a/db/migrate/20151110180108_add_togglable_fields_to_event.rb +++ b/db/migrate/20151110180108_add_togglable_fields_to_event.rb @@ -1,4 +1,4 @@ -class AddTogglableFieldsToEvent < ActiveRecord::Migration +class AddTogglableFieldsToEvent < ActiveRecord::Migration[4.2] def change add_column :events, :display_students, :boolean add_column :events, :display_coaches, :boolean diff --git a/db/migrate/20160123192121_add_approve_by_to_job.rb b/db/migrate/20160123192121_add_approve_by_to_job.rb index 33f9af65b..e056f0cfe 100644 --- a/db/migrate/20160123192121_add_approve_by_to_job.rb +++ b/db/migrate/20160123192121_add_approve_by_to_job.rb @@ -1,4 +1,4 @@ -class AddApproveByToJob < ActiveRecord::Migration +class AddApproveByToJob < ActiveRecord::Migration[4.2] def change add_column :jobs, :approved_by_id, :integer, index: true end diff --git a/db/migrate/20160124024112_add_preferred_pronoun_to_member.rb b/db/migrate/20160124024112_add_preferred_pronoun_to_member.rb index 1deb687a3..f0c127e18 100644 --- a/db/migrate/20160124024112_add_preferred_pronoun_to_member.rb +++ b/db/migrate/20160124024112_add_preferred_pronoun_to_member.rb @@ -1,4 +1,4 @@ -class AddPreferredPronounToMember < ActiveRecord::Migration +class AddPreferredPronounToMember < ActiveRecord::Migration[4.2] def change add_column :members, :preferred_pronoun, :string end diff --git a/db/migrate/20160124225727_add_active_to_chapter.rb b/db/migrate/20160124225727_add_active_to_chapter.rb index 6baa9494c..64fe13c99 100644 --- a/db/migrate/20160124225727_add_active_to_chapter.rb +++ b/db/migrate/20160124225727_add_active_to_chapter.rb @@ -1,4 +1,4 @@ -class AddActiveToChapter < ActiveRecord::Migration +class AddActiveToChapter < ActiveRecord::Migration[4.2] def change add_column :chapters, :active, :boolean, null: true, default: true end diff --git a/db/migrate/20160201210920_change_meeting_fields.rb b/db/migrate/20160201210920_change_meeting_fields.rb index f4d023c5c..3cdab59d2 100644 --- a/db/migrate/20160201210920_change_meeting_fields.rb +++ b/db/migrate/20160201210920_change_meeting_fields.rb @@ -1,4 +1,4 @@ -class ChangeMeetingFields < ActiveRecord::Migration +class ChangeMeetingFields < ActiveRecord::Migration[4.2] def change add_column :meetings, :invitable, :boolean add_column :meetings, :spaces, :integer diff --git a/db/migrate/20160207151405_create_meeting_invitation.rb b/db/migrate/20160207151405_create_meeting_invitation.rb index 4c88cd9af..5d96e23c4 100644 --- a/db/migrate/20160207151405_create_meeting_invitation.rb +++ b/db/migrate/20160207151405_create_meeting_invitation.rb @@ -1,4 +1,4 @@ -class CreateMeetingInvitation < ActiveRecord::Migration +class CreateMeetingInvitation < ActiveRecord::Migration[4.2] def change create_table :meeting_invitations do |t| t.references :meeting, index: true diff --git a/db/migrate/20160211182925_change_meeting_description_to_text.rb b/db/migrate/20160211182925_change_meeting_description_to_text.rb index 6267ba119..830d90220 100644 --- a/db/migrate/20160211182925_change_meeting_description_to_text.rb +++ b/db/migrate/20160211182925_change_meeting_description_to_text.rb @@ -1,4 +1,4 @@ -class ChangeMeetingDescriptionToText < ActiveRecord::Migration +class ChangeMeetingDescriptionToText < ActiveRecord::Migration[4.2] def change change_column :meetings, :description, :text end diff --git a/db/migrate/20160228102639_change_preferred_pronoun_to_pronouns_in_member.rb b/db/migrate/20160228102639_change_preferred_pronoun_to_pronouns_in_member.rb index 12e541496..c49468730 100644 --- a/db/migrate/20160228102639_change_preferred_pronoun_to_pronouns_in_member.rb +++ b/db/migrate/20160228102639_change_preferred_pronoun_to_pronouns_in_member.rb @@ -1,4 +1,4 @@ -class ChangePreferredPronounToPronounsInMember < ActiveRecord::Migration +class ChangePreferredPronounToPronounsInMember < ActiveRecord::Migration[4.2] def change rename_column :members, :preferred_pronoun, :pronouns end diff --git a/db/migrate/20160306231907_rename_table_sessions_to_workshop.rb b/db/migrate/20160306231907_rename_table_sessions_to_workshop.rb index 872c5bdd2..73e5b22c1 100644 --- a/db/migrate/20160306231907_rename_table_sessions_to_workshop.rb +++ b/db/migrate/20160306231907_rename_table_sessions_to_workshop.rb @@ -1,4 +1,4 @@ -class RenameTableSessionsToWorkshop < ActiveRecord::Migration +class RenameTableSessionsToWorkshop < ActiveRecord::Migration[4.2] def change rename_table :sessions, :workshops end diff --git a/db/migrate/20160306234034_rename_session_ids_to_workshop_ids.rb b/db/migrate/20160306234034_rename_session_ids_to_workshop_ids.rb index cbd14f29f..44b30f84c 100644 --- a/db/migrate/20160306234034_rename_session_ids_to_workshop_ids.rb +++ b/db/migrate/20160306234034_rename_session_ids_to_workshop_ids.rb @@ -1,4 +1,4 @@ -class RenameSessionIdsToWorkshopIds < ActiveRecord::Migration +class RenameSessionIdsToWorkshopIds < ActiveRecord::Migration[4.2] def change rename_column :feedback_requests, :sessions_id, :workshop_id rename_column :session_invitations, :sessions_id, :workshop_id diff --git a/db/migrate/20160307015747_rename_sponsor_sessions_to_workshop_sponsors.rb b/db/migrate/20160307015747_rename_sponsor_sessions_to_workshop_sponsors.rb index 55c7569f2..9655746d6 100644 --- a/db/migrate/20160307015747_rename_sponsor_sessions_to_workshop_sponsors.rb +++ b/db/migrate/20160307015747_rename_sponsor_sessions_to_workshop_sponsors.rb @@ -1,4 +1,4 @@ -class RenameSponsorSessionsToWorkshopSponsors < ActiveRecord::Migration +class RenameSponsorSessionsToWorkshopSponsors < ActiveRecord::Migration[4.2] def change rename_table :sponsor_sessions, :workshop_sponsors end diff --git a/db/migrate/20160307223728_rename_permissions_resource_type_value_to_workshop.rb b/db/migrate/20160307223728_rename_permissions_resource_type_value_to_workshop.rb index b7958c263..eb5828b44 100644 --- a/db/migrate/20160307223728_rename_permissions_resource_type_value_to_workshop.rb +++ b/db/migrate/20160307223728_rename_permissions_resource_type_value_to_workshop.rb @@ -1,4 +1,4 @@ -class RenamePermissionsResourceTypeValueToWorkshop < ActiveRecord::Migration +class RenamePermissionsResourceTypeValueToWorkshop < ActiveRecord::Migration[4.2] def change session_permissions = Permission.where(resource_type: 'Sessions') diff --git a/db/migrate/20160320164227_add_attended_to_meeting_invitation.rb b/db/migrate/20160320164227_add_attended_to_meeting_invitation.rb index 5f64a1f92..1bce2c221 100644 --- a/db/migrate/20160320164227_add_attended_to_meeting_invitation.rb +++ b/db/migrate/20160320164227_add_attended_to_meeting_invitation.rb @@ -1,4 +1,4 @@ -class AddAttendedToMeetingInvitation < ActiveRecord::Migration +class AddAttendedToMeetingInvitation < ActiveRecord::Migration[4.2] def change add_column :meeting_invitations, :attended, :boolean, default: false end diff --git a/db/migrate/20160326003113_add_more_data_to_bans.rb b/db/migrate/20160326003113_add_more_data_to_bans.rb index c939cd6e5..4412e9df0 100644 --- a/db/migrate/20160326003113_add_more_data_to_bans.rb +++ b/db/migrate/20160326003113_add_more_data_to_bans.rb @@ -1,4 +1,4 @@ -class AddMoreDataToBans < ActiveRecord::Migration +class AddMoreDataToBans < ActiveRecord::Migration[4.2] def change add_column :bans, :permanent, :boolean, default: false add_column :bans, :explanation, :text diff --git a/db/migrate/20160424081653_create_chapters_meetings.rb b/db/migrate/20160424081653_create_chapters_meetings.rb index 495b7baee..9dec92529 100644 --- a/db/migrate/20160424081653_create_chapters_meetings.rb +++ b/db/migrate/20160424081653_create_chapters_meetings.rb @@ -1,4 +1,4 @@ -class CreateChaptersMeetings < ActiveRecord::Migration +class CreateChaptersMeetings < ActiveRecord::Migration[4.2] def change create_table :chapters_meetings do |t| t.belongs_to :chapter, index: true diff --git a/db/migrate/20160424175400_add_invited_flag_to_meetings.rb b/db/migrate/20160424175400_add_invited_flag_to_meetings.rb index ae104782c..8524374b0 100644 --- a/db/migrate/20160424175400_add_invited_flag_to_meetings.rb +++ b/db/migrate/20160424175400_add_invited_flag_to_meetings.rb @@ -1,4 +1,4 @@ -class AddInvitedFlagToMeetings < ActiveRecord::Migration +class AddInvitedFlagToMeetings < ActiveRecord::Migration[4.2] def change add_column :meetings, :invites_sent, :boolean, default: false end diff --git a/db/migrate/20160523171604_add_external_event_link_to_event.rb b/db/migrate/20160523171604_add_external_event_link_to_event.rb index ce7417465..6e9aa7643 100644 --- a/db/migrate/20160523171604_add_external_event_link_to_event.rb +++ b/db/migrate/20160523171604_add_external_event_link_to_event.rb @@ -1,4 +1,4 @@ -class AddExternalEventLinkToEvent < ActiveRecord::Migration +class AddExternalEventLinkToEvent < ActiveRecord::Migration[4.2] def change add_column :events, :external_url, :string end diff --git a/db/migrate/20160523173346_add_more_fields_to_events.rb b/db/migrate/20160523173346_add_more_fields_to_events.rb index ab62a6c3d..c27a9aa7f 100644 --- a/db/migrate/20160523173346_add_more_fields_to_events.rb +++ b/db/migrate/20160523173346_add_more_fields_to_events.rb @@ -1,4 +1,4 @@ -class AddMoreFieldsToEvents < ActiveRecord::Migration +class AddMoreFieldsToEvents < ActiveRecord::Migration[4.2] def change add_column :events, :confirmation_required, :boolean, default: false add_column :events, :surveys_required, :boolean, default: false diff --git a/db/migrate/20160526182452_add_rsvp_time_to_session_invitation.rb b/db/migrate/20160526182452_add_rsvp_time_to_session_invitation.rb index 1a6909cca..2bd1836a4 100644 --- a/db/migrate/20160526182452_add_rsvp_time_to_session_invitation.rb +++ b/db/migrate/20160526182452_add_rsvp_time_to_session_invitation.rb @@ -1,4 +1,4 @@ -class AddRsvpTimeToSessionInvitation < ActiveRecord::Migration +class AddRsvpTimeToSessionInvitation < ActiveRecord::Migration[4.2] def change add_column :session_invitations, :rsvp_time, :datetime end diff --git a/db/migrate/20160614203328_add_target_group_to_event.rb b/db/migrate/20160614203328_add_target_group_to_event.rb index acefd02e6..13dc3e30a 100644 --- a/db/migrate/20160614203328_add_target_group_to_event.rb +++ b/db/migrate/20160614203328_add_target_group_to_event.rb @@ -1,4 +1,4 @@ -class AddTargetGroupToEvent < ActiveRecord::Migration +class AddTargetGroupToEvent < ActiveRecord::Migration[4.2] def change add_column :events, :audience, :string end diff --git a/db/migrate/20161028141043_add_rsvp_open_time_to_workshops.rb b/db/migrate/20161028141043_add_rsvp_open_time_to_workshops.rb index e1af7524f..d9aec388f 100644 --- a/db/migrate/20161028141043_add_rsvp_open_time_to_workshops.rb +++ b/db/migrate/20161028141043_add_rsvp_open_time_to_workshops.rb @@ -1,4 +1,4 @@ -class AddRsvpOpenTimeToWorkshops < ActiveRecord::Migration +class AddRsvpOpenTimeToWorkshops < ActiveRecord::Migration[4.2] def change add_column :workshops, :rsvp_open_time, :datetime add_column :workshops, :rsvp_open_date, :datetime diff --git a/db/migrate/20161228121833_add_workshop_id_to_feedback.rb b/db/migrate/20161228121833_add_workshop_id_to_feedback.rb index 9611f532a..c6b82afb6 100644 --- a/db/migrate/20161228121833_add_workshop_id_to_feedback.rb +++ b/db/migrate/20161228121833_add_workshop_id_to_feedback.rb @@ -1,4 +1,4 @@ -class AddWorkshopIdToFeedback < ActiveRecord::Migration +class AddWorkshopIdToFeedback < ActiveRecord::Migration[4.2] def change add_column :feedbacks, :workshop_id, :integer end diff --git a/db/migrate/20180108210921_remove_time_from_workshops.rb b/db/migrate/20180108210921_remove_time_from_workshops.rb index a5533fd6e..eb096e9b4 100644 --- a/db/migrate/20180108210921_remove_time_from_workshops.rb +++ b/db/migrate/20180108210921_remove_time_from_workshops.rb @@ -1,4 +1,4 @@ -class RemoveTimeFromWorkshops < ActiveRecord::Migration +class RemoveTimeFromWorkshops < ActiveRecord::Migration[4.2] def change remove_column :workshops, :time, :datetime end diff --git a/db/migrate/20180109024411_add_rsvp_opens_at_to_workshops.rb b/db/migrate/20180109024411_add_rsvp_opens_at_to_workshops.rb index 6a0466403..02ff5bb02 100644 --- a/db/migrate/20180109024411_add_rsvp_opens_at_to_workshops.rb +++ b/db/migrate/20180109024411_add_rsvp_opens_at_to_workshops.rb @@ -1,4 +1,4 @@ -class AddRsvpOpensAtToWorkshops < ActiveRecord::Migration +class AddRsvpOpensAtToWorkshops < ActiveRecord::Migration[4.2] def change rename_column :workshops, :rsvp_open_time, :rsvp_opens_at remove_column :workshops, :rsvp_open_date, :datetime diff --git a/db/migrate/20180109030511_add_accessibility_info_to_sponsors.rb b/db/migrate/20180109030511_add_accessibility_info_to_sponsors.rb index d3960159d..ffb88eb5c 100644 --- a/db/migrate/20180109030511_add_accessibility_info_to_sponsors.rb +++ b/db/migrate/20180109030511_add_accessibility_info_to_sponsors.rb @@ -1,4 +1,4 @@ -class AddAccessibilityInfoToSponsors < ActiveRecord::Migration +class AddAccessibilityInfoToSponsors < ActiveRecord::Migration[4.2] def change add_column :sponsors, :accessibility_info, :text end diff --git a/db/migrate/20180110212924_add_time_zone_to_chapters.rb b/db/migrate/20180110212924_add_time_zone_to_chapters.rb index 54ec8c0a5..ada507560 100644 --- a/db/migrate/20180110212924_add_time_zone_to_chapters.rb +++ b/db/migrate/20180110212924_add_time_zone_to_chapters.rb @@ -1,4 +1,4 @@ -class AddTimeZoneToChapters < ActiveRecord::Migration +class AddTimeZoneToChapters < ActiveRecord::Migration[4.2] def change add_column :chapters, :time_zone, :string, null: false, default: 'London' end diff --git a/db/migrate/20180307221521_add_level_to_sponsors.rb b/db/migrate/20180307221521_add_level_to_sponsors.rb index fe23e99d1..c052d6682 100644 --- a/db/migrate/20180307221521_add_level_to_sponsors.rb +++ b/db/migrate/20180307221521_add_level_to_sponsors.rb @@ -1,4 +1,4 @@ -class AddLevelToSponsors < ActiveRecord::Migration +class AddLevelToSponsors < ActiveRecord::Migration[4.2] def up # hidden: 0, # standard: 1, diff --git a/db/migrate/20180313165054_rename_table_session_invitations_to_workshop_invitations.rb b/db/migrate/20180313165054_rename_table_session_invitations_to_workshop_invitations.rb index 2e2b0f11b..e09b937ef 100644 --- a/db/migrate/20180313165054_rename_table_session_invitations_to_workshop_invitations.rb +++ b/db/migrate/20180313165054_rename_table_session_invitations_to_workshop_invitations.rb @@ -1,4 +1,4 @@ -class RenameTableSessionInvitationsToWorkshopInvitations < ActiveRecord::Migration +class RenameTableSessionInvitationsToWorkshopInvitations < ActiveRecord::Migration[4.2] def change rename_table :session_invitations, :workshop_invitations end diff --git a/db/migrate/20180430001328_add_unique_index_to_meeting_slug.rb b/db/migrate/20180430001328_add_unique_index_to_meeting_slug.rb index a891c686c..2234585f1 100644 --- a/db/migrate/20180430001328_add_unique_index_to_meeting_slug.rb +++ b/db/migrate/20180430001328_add_unique_index_to_meeting_slug.rb @@ -1,4 +1,4 @@ -class AddUniqueIndexToMeetingSlug < ActiveRecord::Migration +class AddUniqueIndexToMeetingSlug < ActiveRecord::Migration[4.2] def change add_index :meetings, :slug, unique: true end diff --git a/db/migrate/20180519231943_add_unique_index_to_event_slug.rb b/db/migrate/20180519231943_add_unique_index_to_event_slug.rb index 73fd1e43e..afd83d3c1 100644 --- a/db/migrate/20180519231943_add_unique_index_to_event_slug.rb +++ b/db/migrate/20180519231943_add_unique_index_to_event_slug.rb @@ -1,4 +1,4 @@ -class AddUniqueIndexToEventSlug < ActiveRecord::Migration +class AddUniqueIndexToEventSlug < ActiveRecord::Migration[4.2] def change add_index :events, :slug, unique: true end diff --git a/db/migrate/20180608010545_add_directions_to_addresses.rb b/db/migrate/20180608010545_add_directions_to_addresses.rb index f2822d14b..6e82b0937 100644 --- a/db/migrate/20180608010545_add_directions_to_addresses.rb +++ b/db/migrate/20180608010545_add_directions_to_addresses.rb @@ -1,4 +1,4 @@ -class AddDirectionsToAddresses < ActiveRecord::Migration +class AddDirectionsToAddresses < ActiveRecord::Migration[4.2] def change add_column :addresses, :directions, :text end diff --git a/db/migrate/20181002213441_extend_job_model.rb b/db/migrate/20181002213441_extend_job_model.rb index f73d80217..f87b43184 100644 --- a/db/migrate/20181002213441_extend_job_model.rb +++ b/db/migrate/20181002213441_extend_job_model.rb @@ -1,4 +1,4 @@ -class ExtendJobModel < ActiveRecord::Migration +class ExtendJobModel < ActiveRecord::Migration[4.2] def change add_column :jobs, :company_website, :string add_column :jobs, :company_address, :string diff --git a/db/migrate/20181012015419_create_friendly_id_slugs.rb b/db/migrate/20181012015419_create_friendly_id_slugs.rb index 691514af5..ed5b88256 100644 --- a/db/migrate/20181012015419_create_friendly_id_slugs.rb +++ b/db/migrate/20181012015419_create_friendly_id_slugs.rb @@ -1,11 +1,4 @@ -migration_class = - if ActiveRecord::VERSION::MAJOR >= 5 - ActiveRecord::Migration[4.2] - else - ActiveRecord::Migration - end - -class CreateFriendlyIdSlugs < migration_class +class CreateFriendlyIdSlugs < ActiveRecord::Migration[4.2] def change create_table :friendly_id_slugs do |t| t.string :slug, :null => false diff --git a/db/migrate/20181012015504_add_slug_to_job.rb b/db/migrate/20181012015504_add_slug_to_job.rb index dcce3f8fa..0342e0786 100644 --- a/db/migrate/20181012015504_add_slug_to_job.rb +++ b/db/migrate/20181012015504_add_slug_to_job.rb @@ -1,4 +1,4 @@ -class AddSlugToJob < ActiveRecord::Migration +class AddSlugToJob < ActiveRecord::Migration[4.2] def change add_column :jobs, :slug, :string end diff --git a/db/migrate/20181013224547_add_status_to_job.rb b/db/migrate/20181013224547_add_status_to_job.rb index de4a4b78d..0ed1f7c69 100644 --- a/db/migrate/20181013224547_add_status_to_job.rb +++ b/db/migrate/20181013224547_add_status_to_job.rb @@ -1,4 +1,4 @@ -class AddStatusToJob < ActiveRecord::Migration +class AddStatusToJob < ActiveRecord::Migration[4.2] def change add_column :jobs, :status, :integer, default: 0 end diff --git a/db/migrate/20181019002645_add_description_to_chapters.rb b/db/migrate/20181019002645_add_description_to_chapters.rb index 5645a2f73..dd007c3eb 100644 --- a/db/migrate/20181019002645_add_description_to_chapters.rb +++ b/db/migrate/20181019002645_add_description_to_chapters.rb @@ -1,4 +1,4 @@ -class AddDescriptionToChapters < ActiveRecord::Migration +class AddDescriptionToChapters < ActiveRecord::Migration[4.2] def change add_column :chapters, :description, :text end diff --git a/db/migrate/20181021014646_add_image_to_chapters.rb b/db/migrate/20181021014646_add_image_to_chapters.rb index eb5f19f4c..6697ced05 100644 --- a/db/migrate/20181021014646_add_image_to_chapters.rb +++ b/db/migrate/20181021014646_add_image_to_chapters.rb @@ -1,4 +1,4 @@ -class AddImageToChapters < ActiveRecord::Migration +class AddImageToChapters < ActiveRecord::Migration[4.2] def change add_column :chapters, :image, :string end diff --git a/db/migrate/20191018175052_add_ends_at_to_workshops.rb b/db/migrate/20191018175052_add_ends_at_to_workshops.rb index 71a4f8be2..ef91fc948 100644 --- a/db/migrate/20191018175052_add_ends_at_to_workshops.rb +++ b/db/migrate/20191018175052_add_ends_at_to_workshops.rb @@ -1,4 +1,4 @@ -class AddEndsAtToWorkshops < ActiveRecord::Migration +class AddEndsAtToWorkshops < ActiveRecord::Migration[4.2] def change add_column :workshops, :ends_at, :datetime end diff --git a/db/migrate/20200120111440_add_accepted_toc_at_to_member.rb b/db/migrate/20200120111440_add_accepted_toc_at_to_member.rb index 400a28658..6fb595f1c 100644 --- a/db/migrate/20200120111440_add_accepted_toc_at_to_member.rb +++ b/db/migrate/20200120111440_add_accepted_toc_at_to_member.rb @@ -1,4 +1,4 @@ -class AddAcceptedTocAtToMember < ActiveRecord::Migration +class AddAcceptedTocAtToMember < ActiveRecord::Migration[4.2] def change add_column :members, :accepted_toc_at, :datetime, default: nil end diff --git a/db/migrate/20200124124311_add_opt_in_newsletter_at_to_member.rb b/db/migrate/20200124124311_add_opt_in_newsletter_at_to_member.rb index 3269957ca..b0f4dcabb 100644 --- a/db/migrate/20200124124311_add_opt_in_newsletter_at_to_member.rb +++ b/db/migrate/20200124124311_add_opt_in_newsletter_at_to_member.rb @@ -1,4 +1,4 @@ -class AddOptInNewsletterAtToMember < ActiveRecord::Migration +class AddOptInNewsletterAtToMember < ActiveRecord::Migration[4.2] def change add_column :members, :opt_in_newsletter_at, :datetime, default: nil end diff --git a/db/migrate/20200311233721_add_virtual_to_workshop.rb b/db/migrate/20200311233721_add_virtual_to_workshop.rb index f91ab51ba..e7c9e78ce 100644 --- a/db/migrate/20200311233721_add_virtual_to_workshop.rb +++ b/db/migrate/20200311233721_add_virtual_to_workshop.rb @@ -1,4 +1,4 @@ -class AddVirtualToWorkshop < ActiveRecord::Migration +class AddVirtualToWorkshop < ActiveRecord::Migration[4.2] def change add_column :workshops, :virtual, :boolean, default: false end diff --git a/db/migrate/20200312172212_add_student_and_coach_spaces_to_workshop.rb b/db/migrate/20200312172212_add_student_and_coach_spaces_to_workshop.rb index 653878e9a..015b93315 100644 --- a/db/migrate/20200312172212_add_student_and_coach_spaces_to_workshop.rb +++ b/db/migrate/20200312172212_add_student_and_coach_spaces_to_workshop.rb @@ -1,4 +1,4 @@ -class AddStudentAndCoachSpacesToWorkshop < ActiveRecord::Migration +class AddStudentAndCoachSpacesToWorkshop < ActiveRecord::Migration[4.2] def change add_column :workshops, :student_spaces, :integer, default: 0 add_column :workshops, :coach_spaces, :integer, default: 0 diff --git a/db/migrate/20200313211614_add_slack_channel_and_slack_channel_link_to_workshop.rb b/db/migrate/20200313211614_add_slack_channel_and_slack_channel_link_to_workshop.rb index 0238947e2..8843d0e7b 100644 --- a/db/migrate/20200313211614_add_slack_channel_and_slack_channel_link_to_workshop.rb +++ b/db/migrate/20200313211614_add_slack_channel_and_slack_channel_link_to_workshop.rb @@ -1,4 +1,4 @@ -class AddSlackChannelAndSlackChannelLinkToWorkshop < ActiveRecord::Migration +class AddSlackChannelAndSlackChannelLinkToWorkshop < ActiveRecord::Migration[4.2] def change add_column :workshops, :slack_channel, :string add_column :workshops, :slack_channel_link, :string diff --git a/db/migrate/20200511151348_add_automated_rsvp_to_workshop_invitation.rb b/db/migrate/20200511151348_add_automated_rsvp_to_workshop_invitation.rb index 26c5903de..4e9ce4986 100644 --- a/db/migrate/20200511151348_add_automated_rsvp_to_workshop_invitation.rb +++ b/db/migrate/20200511151348_add_automated_rsvp_to_workshop_invitation.rb @@ -1,4 +1,4 @@ -class AddAutomatedRsvpToWorkshopInvitation < ActiveRecord::Migration +class AddAutomatedRsvpToWorkshopInvitation < ActiveRecord::Migration[4.2] def change add_column :workshop_invitations, :automated_rsvp, :boolean end diff --git a/db/migrate/20200521151343_add_tutorial_to_workshop_invitation.rb b/db/migrate/20200521151343_add_tutorial_to_workshop_invitation.rb index 01609feba..bdb8f3cd0 100644 --- a/db/migrate/20200521151343_add_tutorial_to_workshop_invitation.rb +++ b/db/migrate/20200521151343_add_tutorial_to_workshop_invitation.rb @@ -1,4 +1,4 @@ -class AddTutorialToWorkshopInvitation < ActiveRecord::Migration +class AddTutorialToWorkshopInvitation < ActiveRecord::Migration[4.2] def change add_column :workshop_invitations, :tutorial, :text end diff --git a/db/migrate/20200522142646_add_email_index_to_member.rb b/db/migrate/20200522142646_add_email_index_to_member.rb index 84279e2a4..bd0602237 100644 --- a/db/migrate/20200522142646_add_email_index_to_member.rb +++ b/db/migrate/20200522142646_add_email_index_to_member.rb @@ -1,4 +1,4 @@ -class AddEmailIndexToMember < ActiveRecord::Migration +class AddEmailIndexToMember < ActiveRecord::Migration[4.2] def change add_index :members, :email, unique: true end diff --git a/db/migrate/20200721072708_update_contacts.rb b/db/migrate/20200721072708_update_contacts.rb index 3c2557aaa..3fa632fce 100644 --- a/db/migrate/20200721072708_update_contacts.rb +++ b/db/migrate/20200721072708_update_contacts.rb @@ -1,4 +1,4 @@ -class UpdateContacts < ActiveRecord::Migration +class UpdateContacts < ActiveRecord::Migration[4.2] def change add_column :contacts, :name, :string add_column :contacts, :surname, :string diff --git a/db/migrate/20200805104520_add_level_to_sponsorship.rb b/db/migrate/20200805104520_add_level_to_sponsorship.rb index df37c99d9..5bca1db65 100644 --- a/db/migrate/20200805104520_add_level_to_sponsorship.rb +++ b/db/migrate/20200805104520_add_level_to_sponsorship.rb @@ -1,4 +1,4 @@ -class AddLevelToSponsorship < ActiveRecord::Migration +class AddLevelToSponsorship < ActiveRecord::Migration[4.2] def change add_column :sponsorships, :level, :string end diff --git a/db/migrate/20200815141515_add_token_to_contact.rb b/db/migrate/20200815141515_add_token_to_contact.rb index 629a0dd1a..305cb9f5c 100644 --- a/db/migrate/20200815141515_add_token_to_contact.rb +++ b/db/migrate/20200815141515_add_token_to_contact.rb @@ -1,4 +1,4 @@ -class AddTokenToContact < ActiveRecord::Migration +class AddTokenToContact < ActiveRecord::Migration[4.2] def change add_column :contacts, :token, :string, null: false end diff --git a/db/migrate/20201109043756_add_end_dt_to_meetings_courses.rb b/db/migrate/20201109043756_add_end_dt_to_meetings_courses.rb index 406a4407d..f9b8df26c 100644 --- a/db/migrate/20201109043756_add_end_dt_to_meetings_courses.rb +++ b/db/migrate/20201109043756_add_end_dt_to_meetings_courses.rb @@ -1,4 +1,4 @@ -class AddEndDtToMeetingsCourses < ActiveRecord::Migration +class AddEndDtToMeetingsCourses < ActiveRecord::Migration[4.2] def change add_column :meetings, :ends_at, :datetime add_column :courses, :ends_at, :datetime diff --git a/db/migrate/20201120012424_drop_member_contacts.rb b/db/migrate/20201120012424_drop_member_contacts.rb index c04ffbeed..0b8a117de 100644 --- a/db/migrate/20201120012424_drop_member_contacts.rb +++ b/db/migrate/20201120012424_drop_member_contacts.rb @@ -1,4 +1,4 @@ -class DropMemberContacts < ActiveRecord::Migration +class DropMemberContacts < ActiveRecord::Migration[4.2] def change drop_table :member_contacts end diff --git a/db/migrate/20201120012812_remove_contact_details_from_sponsor.rb b/db/migrate/20201120012812_remove_contact_details_from_sponsor.rb index cf817fe27..4a772295d 100644 --- a/db/migrate/20201120012812_remove_contact_details_from_sponsor.rb +++ b/db/migrate/20201120012812_remove_contact_details_from_sponsor.rb @@ -1,4 +1,4 @@ -class RemoveContactDetailsFromSponsor < ActiveRecord::Migration +class RemoveContactDetailsFromSponsor < ActiveRecord::Migration[4.2] def change remove_column :sponsors, :contact_first_name remove_column :sponsors, :contact_surname diff --git a/db/migrate/20220820180050_add_virtual_to_events.rb b/db/migrate/20220820180050_add_virtual_to_events.rb index 0c168a089..5acc7a9c7 100644 --- a/db/migrate/20220820180050_add_virtual_to_events.rb +++ b/db/migrate/20220820180050_add_virtual_to_events.rb @@ -1,4 +1,4 @@ -class AddVirtualToEvents < ActiveRecord::Migration +class AddVirtualToEvents < ActiveRecord::Migration[4.2] def change add_column :events, :virtual, :boolean, null: false, default: false end diff --git a/db/migrate/20230722001140_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20230722001140_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb new file mode 100644 index 000000000..7c3958963 --- /dev/null +++ b/db/migrate/20230722001140_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb @@ -0,0 +1,23 @@ +# This migration comes from acts_as_taggable_on_engine (originally 6) +if ActiveRecord.gem_version >= Gem::Version.new('5.0') + class AddMissingIndexesOnTaggings < ActiveRecord::Migration[4.2]; end +else + class AddMissingIndexesOnTaggings < ActiveRecord::Migration; end +end +AddMissingIndexesOnTaggings.class_eval do + def change + add_index ActsAsTaggableOn.taggings_table, :tag_id unless index_exists? ActsAsTaggableOn.taggings_table, :tag_id + add_index ActsAsTaggableOn.taggings_table, :taggable_id unless index_exists? ActsAsTaggableOn.taggings_table, :taggable_id + add_index ActsAsTaggableOn.taggings_table, :taggable_type unless index_exists? ActsAsTaggableOn.taggings_table, :taggable_type + add_index ActsAsTaggableOn.taggings_table, :tagger_id unless index_exists? ActsAsTaggableOn.taggings_table, :tagger_id + add_index ActsAsTaggableOn.taggings_table, :context unless index_exists? ActsAsTaggableOn.taggings_table, :context + + unless index_exists? ActsAsTaggableOn.taggings_table, [:tagger_id, :tagger_type] + add_index ActsAsTaggableOn.taggings_table, [:tagger_id, :tagger_type] + end + + unless index_exists? ActsAsTaggableOn.taggings_table, [:taggable_id, :taggable_type, :tagger_id, :context], name: 'taggings_idy' + add_index ActsAsTaggableOn.taggings_table, [:taggable_id, :taggable_type, :tagger_id, :context], name: 'taggings_idy' + end + end +end diff --git a/db/migrate/20230722001141_add_tenant_to_taggings.acts_as_taggable_on_engine.rb b/db/migrate/20230722001141_add_tenant_to_taggings.acts_as_taggable_on_engine.rb new file mode 100644 index 000000000..2e6da5148 --- /dev/null +++ b/db/migrate/20230722001141_add_tenant_to_taggings.acts_as_taggable_on_engine.rb @@ -0,0 +1,17 @@ +# This migration comes from acts_as_taggable_on_engine (originally 7) +if ActiveRecord.gem_version >= Gem::Version.new('5.0') + class AddTenantToTaggings < ActiveRecord::Migration[4.2]; end +else + class AddTenantToTaggings < ActiveRecord::Migration; end +end +AddTenantToTaggings.class_eval do + def self.up + add_column :taggings, :tenant, :string, limit: 128 + add_index :taggings, :tenant unless index_exists? :taggings, :tenant + end + + def self.down + remove_index :taggings, :tenant + remove_column :taggings, :tenant + end +end diff --git a/db/schema.rb b/db/schema.rb index 58d2d8a35..243d7d875 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -11,583 +10,556 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20220820180050) do +ActiveRecord::Schema.define(version: 2023_07_22_001141) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" create_table "activities", force: :cascade do |t| - t.integer "trackable_id" - t.string "trackable_type" - t.integer "owner_id" - t.string "owner_type" - t.string "key" - t.text "parameters" - t.integer "recipient_id" - t.string "recipient_type" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "activities", ["owner_id", "owner_type"], name: "index_activities_on_owner_id_and_owner_type", using: :btree - add_index "activities", ["recipient_id", "recipient_type"], name: "index_activities_on_recipient_id_and_recipient_type", using: :btree - add_index "activities", ["trackable_id", "trackable_type"], name: "index_activities_on_trackable_id_and_trackable_type", using: :btree - - create_table "addresses", force: :cascade do |t| - t.string "flat" - t.string "street" - t.string "postal_code" - t.integer "sponsor_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "city" - t.string "latitude" - t.string "longitude" - t.text "directions" - end - - create_table "announcements", force: :cascade do |t| + t.string "trackable_type" + t.bigint "trackable_id" + t.string "owner_type" + t.bigint "owner_id" + t.string "key" + t.text "parameters" + t.string "recipient_type" + t.bigint "recipient_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["owner_id", "owner_type"], name: "index_activities_on_owner_id_and_owner_type" + t.index ["owner_type", "owner_id"], name: "index_activities_on_owner_type_and_owner_id" + t.index ["recipient_id", "recipient_type"], name: "index_activities_on_recipient_id_and_recipient_type" + t.index ["recipient_type", "recipient_id"], name: "index_activities_on_recipient_type_and_recipient_id" + t.index ["trackable_id", "trackable_type"], name: "index_activities_on_trackable_id_and_trackable_type" + t.index ["trackable_type", "trackable_id"], name: "index_activities_on_trackable_type_and_trackable_id" + end + + create_table "addresses", id: :serial, force: :cascade do |t| + t.string "flat" + t.string "street" + t.string "postal_code" + t.integer "sponsor_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "city" + t.string "latitude" + t.string "longitude" + t.text "directions" + end + + create_table "announcements", id: :serial, force: :cascade do |t| t.datetime "expires_at" - t.text "message" - t.integer "created_by_id" + t.text "message" + t.integer "created_by_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["created_by_id"], name: "index_announcements_on_created_by_id" end - add_index "announcements", ["created_by_id"], name: "index_announcements_on_created_by_id", using: :btree - - create_table "attendance_warnings", force: :cascade do |t| - t.integer "member_id" - t.integer "sent_by_id" + create_table "attendance_warnings", id: :serial, force: :cascade do |t| + t.integer "member_id" + t.integer "sent_by_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["member_id"], name: "index_attendance_warnings_on_member_id" + t.index ["sent_by_id"], name: "index_attendance_warnings_on_sent_by_id" end - add_index "attendance_warnings", ["member_id"], name: "index_attendance_warnings_on_member_id", using: :btree - add_index "attendance_warnings", ["sent_by_id"], name: "index_attendance_warnings_on_sent_by_id", using: :btree - - create_table "auth_services", force: :cascade do |t| - t.integer "member_id" - t.string "provider" - t.string "uid" + create_table "auth_services", id: :serial, force: :cascade do |t| + t.integer "member_id" + t.string "provider" + t.string "uid" t.datetime "created_at" t.datetime "updated_at" + t.index ["member_id"], name: "index_auth_services_on_member_id" end - add_index "auth_services", ["member_id"], name: "index_auth_services_on_member_id", using: :btree - - create_table "bans", force: :cascade do |t| - t.integer "member_id" + create_table "bans", id: :serial, force: :cascade do |t| + t.integer "member_id" t.datetime "expires_at" - t.string "reason" - t.text "note" - t.integer "added_by_id" + t.string "reason" + t.text "note" + t.integer "added_by_id" t.datetime "created_at" t.datetime "updated_at" - t.boolean "permanent", default: false - t.text "explanation" + t.boolean "permanent", default: false + t.text "explanation" + t.index ["added_by_id"], name: "index_bans_on_added_by_id" + t.index ["member_id"], name: "index_bans_on_member_id" end - add_index "bans", ["added_by_id"], name: "index_bans_on_added_by_id", using: :btree - add_index "bans", ["member_id"], name: "index_bans_on_member_id", using: :btree - - create_table "chapters", force: :cascade do |t| - t.string "name" - t.string "city" + create_table "chapters", id: :serial, force: :cascade do |t| + t.string "name" + t.string "city" t.datetime "created_at" t.datetime "updated_at" - t.string "email" - t.string "twitter" - t.string "twitter_id" - t.string "slug" - t.boolean "active", default: true - t.string "time_zone", default: "London", null: false - t.text "description" - t.string "image" + t.string "email" + t.string "twitter" + t.string "twitter_id" + t.string "slug" + t.boolean "active", default: true + t.string "time_zone", default: "London", null: false + t.text "description" + t.string "image" end - create_table "chapters_events", force: :cascade do |t| + create_table "chapters_events", id: :serial, force: :cascade do |t| t.integer "chapter_id" t.integer "event_id" + t.index ["chapter_id"], name: "index_chapters_events_on_chapter_id" + t.index ["event_id"], name: "index_chapters_events_on_event_id" end - add_index "chapters_events", ["chapter_id"], name: "index_chapters_events_on_chapter_id", using: :btree - add_index "chapters_events", ["event_id"], name: "index_chapters_events_on_event_id", using: :btree - - create_table "chapters_meetings", force: :cascade do |t| + create_table "chapters_meetings", id: :serial, force: :cascade do |t| t.integer "chapter_id" t.integer "meeting_id" + t.index ["chapter_id"], name: "index_chapters_meetings_on_chapter_id" + t.index ["meeting_id"], name: "index_chapters_meetings_on_meeting_id" end - add_index "chapters_meetings", ["chapter_id"], name: "index_chapters_meetings_on_chapter_id", using: :btree - add_index "chapters_meetings", ["meeting_id"], name: "index_chapters_meetings_on_meeting_id", using: :btree - - create_table "contacts", force: :cascade do |t| - t.integer "sponsor_id" + create_table "contacts", id: :serial, force: :cascade do |t| + t.integer "sponsor_id" t.datetime "created_at" t.datetime "updated_at" - t.string "name" - t.string "surname" - t.string "email" - t.boolean "mailing_list_consent", default: false - t.string "token", null: false + t.string "name" + t.string "surname" + t.string "email" + t.boolean "mailing_list_consent", default: false + t.string "token", null: false + t.index ["email", "sponsor_id"], name: "index_contacts_on_email_and_sponsor_id", unique: true + t.index ["sponsor_id"], name: "index_contacts_on_sponsor_id" end - add_index "contacts", ["email", "sponsor_id"], name: "index_contacts_on_email_and_sponsor_id", unique: true, using: :btree - add_index "contacts", ["sponsor_id"], name: "index_contacts_on_sponsor_id", using: :btree - - create_table "course_invitations", force: :cascade do |t| - t.integer "course_id" - t.integer "member_id" - t.boolean "attending" - t.boolean "attended" - t.text "note" - t.string "token" + create_table "course_invitations", id: :serial, force: :cascade do |t| + t.integer "course_id" + t.integer "member_id" + t.boolean "attending" + t.boolean "attended" + t.text "note" + t.string "token" t.datetime "created_at" t.datetime "updated_at" + t.index ["course_id"], name: "index_course_invitations_on_course_id" + t.index ["member_id"], name: "index_course_invitations_on_member_id" end - add_index "course_invitations", ["course_id"], name: "index_course_invitations_on_course_id", using: :btree - add_index "course_invitations", ["member_id"], name: "index_course_invitations_on_member_id", using: :btree - - create_table "course_tutors", force: :cascade do |t| - t.integer "course_id" - t.integer "tutor_id" + create_table "course_tutors", id: :serial, force: :cascade do |t| + t.integer "course_id" + t.integer "tutor_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["course_id"], name: "index_course_tutors_on_course_id" + t.index ["tutor_id"], name: "index_course_tutors_on_tutor_id" end - add_index "course_tutors", ["course_id"], name: "index_course_tutors_on_course_id", using: :btree - add_index "course_tutors", ["tutor_id"], name: "index_course_tutors_on_tutor_id", using: :btree - - create_table "courses", force: :cascade do |t| - t.string "title" - t.string "short_description" - t.text "description" - t.integer "tutor_id" + create_table "courses", id: :serial, force: :cascade do |t| + t.string "title" + t.string "short_description" + t.text "description" + t.integer "tutor_id" t.datetime "date_and_time" - t.integer "seats", default: 0 - t.string "slug" - t.string "url" + t.integer "seats", default: 0 + t.string "slug" + t.string "url" t.datetime "created_at" t.datetime "updated_at" - t.integer "sponsor_id" - t.string "ticket_url" - t.integer "chapter_id" + t.integer "sponsor_id" + t.string "ticket_url" + t.integer "chapter_id" t.datetime "ends_at" + t.index ["chapter_id"], name: "index_courses_on_chapter_id" + t.index ["sponsor_id"], name: "index_courses_on_sponsor_id" + t.index ["tutor_id"], name: "index_courses_on_tutor_id" end - add_index "courses", ["chapter_id"], name: "index_courses_on_chapter_id", using: :btree - add_index "courses", ["sponsor_id"], name: "index_courses_on_sponsor_id", using: :btree - add_index "courses", ["tutor_id"], name: "index_courses_on_tutor_id", using: :btree - - create_table "delayed_jobs", force: :cascade do |t| - t.integer "priority", default: 0, null: false - t.integer "attempts", default: 0, null: false - t.text "handler", null: false - t.text "last_error" + create_table "delayed_jobs", id: :serial, force: :cascade do |t| + t.integer "priority", default: 0, null: false + t.integer "attempts", default: 0, null: false + t.text "handler", null: false + t.text "last_error" t.datetime "run_at" t.datetime "locked_at" t.datetime "failed_at" - t.string "locked_by" - t.string "queue" + t.string "locked_by" + t.string "queue" t.datetime "created_at" t.datetime "updated_at" + t.index ["priority", "run_at"], name: "delayed_jobs_priority" end - add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree - - create_table "eligibility_inquiries", force: :cascade do |t| - t.integer "member_id" - t.integer "sent_by_id" + create_table "eligibility_inquiries", id: :serial, force: :cascade do |t| + t.integer "member_id" + t.integer "sent_by_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["member_id"], name: "index_eligibility_inquiries_on_member_id" + t.index ["sent_by_id"], name: "index_eligibility_inquiries_on_sent_by_id" end - add_index "eligibility_inquiries", ["member_id"], name: "index_eligibility_inquiries_on_member_id", using: :btree - add_index "eligibility_inquiries", ["sent_by_id"], name: "index_eligibility_inquiries_on_sent_by_id", using: :btree - - create_table "events", force: :cascade do |t| - t.string "name" - t.text "description" + create_table "events", id: :serial, force: :cascade do |t| + t.string "name" + t.text "description" t.datetime "date_and_time" t.datetime "ends_at" - t.integer "venue_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "slug" - t.text "schedule" - t.integer "coach_spaces" - t.integer "student_spaces" - t.string "coach_questionnaire" - t.string "student_questionnaire" - t.text "coach_description" - t.string "info" - t.boolean "announce_only" - t.string "url" - t.string "email" - t.boolean "invitable", default: false - t.string "tito_url" - t.boolean "show_faq" - t.boolean "display_students" - t.boolean "display_coaches" - t.string "external_url" - t.boolean "confirmation_required", default: false - t.boolean "surveys_required", default: false - t.string "audience" - t.boolean "virtual", default: false, null: false - end - - add_index "events", ["slug"], name: "index_events_on_slug", unique: true, using: :btree - add_index "events", ["venue_id"], name: "index_events_on_venue_id", using: :btree - - create_table "feedback_requests", force: :cascade do |t| - t.integer "member_id" - t.integer "workshop_id" - t.string "token" - t.boolean "submited" + t.integer "venue_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "slug" + t.text "schedule" + t.integer "coach_spaces" + t.integer "student_spaces" + t.string "coach_questionnaire" + t.string "student_questionnaire" + t.text "coach_description" + t.string "info" + t.boolean "announce_only" + t.string "url" + t.string "email" + t.boolean "invitable", default: false + t.string "tito_url" + t.boolean "show_faq" + t.boolean "display_students" + t.boolean "display_coaches" + t.string "external_url" + t.boolean "confirmation_required", default: false + t.boolean "surveys_required", default: false + t.string "audience" + t.boolean "virtual", default: false, null: false + t.index ["slug"], name: "index_events_on_slug", unique: true + t.index ["venue_id"], name: "index_events_on_venue_id" + end + + create_table "feedback_requests", id: :serial, force: :cascade do |t| + t.integer "member_id" + t.integer "workshop_id" + t.string "token" + t.boolean "submited" t.datetime "created_at" t.datetime "updated_at" + t.index ["member_id"], name: "index_feedback_requests_on_member_id" + t.index ["workshop_id"], name: "index_feedback_requests_on_workshop_id" end - add_index "feedback_requests", ["member_id"], name: "index_feedback_requests_on_member_id", using: :btree - add_index "feedback_requests", ["workshop_id"], name: "index_feedback_requests_on_workshop_id", using: :btree - - create_table "feedbacks", force: :cascade do |t| - t.integer "tutorial_id" - t.text "request" - t.integer "coach_id" - t.text "suggestions" + create_table "feedbacks", id: :serial, force: :cascade do |t| + t.integer "tutorial_id" + t.text "request" + t.integer "coach_id" + t.text "suggestions" t.datetime "created_at" t.datetime "updated_at" - t.integer "rating" - t.integer "workshop_id" + t.integer "rating" + t.integer "workshop_id" + t.index ["coach_id"], name: "index_feedbacks_on_coach_id" + t.index ["tutorial_id"], name: "index_feedbacks_on_tutorial_id" end - add_index "feedbacks", ["coach_id"], name: "index_feedbacks_on_coach_id", using: :btree - add_index "feedbacks", ["tutorial_id"], name: "index_feedbacks_on_tutorial_id", using: :btree - - create_table "friendly_id_slugs", force: :cascade do |t| - t.string "slug", null: false - t.integer "sluggable_id", null: false - t.string "sluggable_type", limit: 50 - t.string "scope" + create_table "friendly_id_slugs", id: :serial, force: :cascade do |t| + t.string "slug", null: false + t.integer "sluggable_id", null: false + t.string "sluggable_type", limit: 50 + t.string "scope" t.datetime "created_at" + t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true + t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" + t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" + t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" end - add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true, using: :btree - add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", using: :btree - add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree - add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree - - create_table "group_announcements", force: :cascade do |t| - t.integer "announcement_id" - t.integer "group_id" + create_table "group_announcements", id: :serial, force: :cascade do |t| + t.integer "announcement_id" + t.integer "group_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["announcement_id"], name: "index_group_announcements_on_announcement_id" + t.index ["group_id"], name: "index_group_announcements_on_group_id" end - add_index "group_announcements", ["announcement_id"], name: "index_group_announcements_on_announcement_id", using: :btree - add_index "group_announcements", ["group_id"], name: "index_group_announcements_on_group_id", using: :btree - - create_table "groups", force: :cascade do |t| - t.integer "chapter_id" - t.string "name" - t.text "description" + create_table "groups", id: :serial, force: :cascade do |t| + t.integer "chapter_id" + t.string "name" + t.text "description" t.datetime "created_at" t.datetime "updated_at" - t.string "mailing_list_id" + t.string "mailing_list_id" + t.index ["chapter_id"], name: "index_groups_on_chapter_id" end - add_index "groups", ["chapter_id"], name: "index_groups_on_chapter_id", using: :btree - - create_table "invitations", force: :cascade do |t| - t.integer "event_id" - t.boolean "attending" - t.integer "member_id" - t.string "role" - t.text "note" + create_table "invitations", id: :serial, force: :cascade do |t| + t.integer "event_id" + t.boolean "attending" + t.integer "member_id" + t.string "role" + t.text "note" t.datetime "created_at" t.datetime "updated_at" - t.string "token" - t.boolean "verified" - t.integer "verified_by_id" + t.string "token" + t.boolean "verified" + t.integer "verified_by_id" + t.index ["event_id"], name: "index_invitations_on_event_id" + t.index ["member_id"], name: "index_invitations_on_member_id" + t.index ["verified_by_id"], name: "index_invitations_on_verified_by_id" end - add_index "invitations", ["event_id"], name: "index_invitations_on_event_id", using: :btree - add_index "invitations", ["member_id"], name: "index_invitations_on_member_id", using: :btree - add_index "invitations", ["verified_by_id"], name: "index_invitations_on_verified_by_id", using: :btree - - create_table "jobs", force: :cascade do |t| - t.string "title" - t.text "description" - t.string "location" + create_table "jobs", id: :serial, force: :cascade do |t| + t.string "title" + t.text "description" + t.string "location" t.datetime "expiry_date" - t.string "email" - t.string "link_to_job" - t.integer "created_by_id" - t.boolean "approved", default: false - t.boolean "submitted", default: false - t.datetime "created_at" - t.datetime "updated_at" - t.string "company" - t.integer "approved_by_id" - t.string "company_website" - t.string "company_address" - t.string "company_postcode" + t.string "email" + t.string "link_to_job" + t.integer "created_by_id" + t.boolean "approved", default: false + t.boolean "submitted", default: false + t.datetime "created_at" + t.datetime "updated_at" + t.string "company" + t.integer "approved_by_id" + t.string "company_website" + t.string "company_address" + t.string "company_postcode" t.datetime "published_on" - t.boolean "remote" - t.integer "salary" - t.string "slug" - t.integer "status", default: 0 + t.boolean "remote" + t.integer "salary" + t.string "slug" + t.integer "status", default: 0 + t.index ["created_by_id"], name: "index_jobs_on_created_by_id" end - add_index "jobs", ["created_by_id"], name: "index_jobs_on_created_by_id", using: :btree - - create_table "meeting_invitations", force: :cascade do |t| - t.integer "meeting_id" - t.boolean "attending" - t.integer "member_id" - t.string "role" - t.text "note" - t.string "token" + create_table "meeting_invitations", id: :serial, force: :cascade do |t| + t.integer "meeting_id" + t.boolean "attending" + t.integer "member_id" + t.string "role" + t.text "note" + t.string "token" t.datetime "created_at" t.datetime "updated_at" - t.boolean "attended", default: false + t.boolean "attended", default: false + t.index ["meeting_id"], name: "index_meeting_invitations_on_meeting_id" + t.index ["member_id"], name: "index_meeting_invitations_on_member_id" end - add_index "meeting_invitations", ["meeting_id"], name: "index_meeting_invitations_on_meeting_id", using: :btree - add_index "meeting_invitations", ["member_id"], name: "index_meeting_invitations_on_member_id", using: :btree - - create_table "meeting_talks", force: :cascade do |t| - t.integer "meeting_id" - t.string "title" - t.string "description" - t.text "abstract" - t.integer "speaker_id" + create_table "meeting_talks", id: :serial, force: :cascade do |t| + t.integer "meeting_id" + t.string "title" + t.string "description" + t.text "abstract" + t.integer "speaker_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["meeting_id"], name: "index_meeting_talks_on_meeting_id" + t.index ["speaker_id"], name: "index_meeting_talks_on_speaker_id" end - add_index "meeting_talks", ["meeting_id"], name: "index_meeting_talks_on_meeting_id", using: :btree - add_index "meeting_talks", ["speaker_id"], name: "index_meeting_talks_on_speaker_id", using: :btree - - create_table "meetings", force: :cascade do |t| + create_table "meetings", id: :serial, force: :cascade do |t| t.datetime "date_and_time" - t.integer "venue_id" + t.integer "venue_id" t.datetime "created_at" t.datetime "updated_at" - t.string "name" - t.text "description" - t.string "slug" - t.boolean "invitable" - t.integer "spaces" - t.integer "sponsor_id" - t.boolean "invites_sent", default: false + t.string "name" + t.text "description" + t.string "slug" + t.boolean "invitable" + t.integer "spaces" + t.integer "sponsor_id" + t.boolean "invites_sent", default: false t.datetime "ends_at" + t.index ["slug"], name: "index_meetings_on_slug", unique: true + t.index ["venue_id"], name: "index_meetings_on_venue_id" end - add_index "meetings", ["slug"], name: "index_meetings_on_slug", unique: true, using: :btree - add_index "meetings", ["venue_id"], name: "index_meetings_on_venue_id", using: :btree - - create_table "member_notes", force: :cascade do |t| - t.integer "member_id" - t.integer "author_id" - t.text "note" + create_table "member_notes", id: :serial, force: :cascade do |t| + t.integer "member_id" + t.integer "author_id" + t.text "note" t.datetime "created_at" t.datetime "updated_at" + t.index ["author_id"], name: "index_member_notes_on_author_id" + t.index ["member_id"], name: "index_member_notes_on_member_id" end - add_index "member_notes", ["author_id"], name: "index_member_notes_on_author_id", using: :btree - add_index "member_notes", ["member_id"], name: "index_member_notes_on_member_id", using: :btree - - create_table "members", force: :cascade do |t| - t.string "name" - t.string "surname" - t.string "email" - t.string "twitter" - t.string "about_you" + create_table "members", id: :serial, force: :cascade do |t| + t.string "name" + t.string "surname" + t.string "email" + t.string "twitter" + t.string "about_you" t.datetime "created_at" t.datetime "updated_at" - t.boolean "unsubscribed" - t.boolean "can_log_in", default: false, null: false - t.string "mobile" - t.boolean "received_coach_welcome_email", default: false - t.boolean "received_student_welcome_email", default: false - t.string "pronouns" + t.boolean "unsubscribed" + t.boolean "can_log_in", default: false, null: false + t.string "mobile" + t.boolean "received_coach_welcome_email", default: false + t.boolean "received_student_welcome_email", default: false + t.string "pronouns" t.datetime "accepted_toc_at" t.datetime "opt_in_newsletter_at" + t.index ["email"], name: "index_members_on_email", unique: true end - add_index "members", ["email"], name: "index_members_on_email", unique: true, using: :btree - create_table "members_permissions", id: false, force: :cascade do |t| t.integer "member_id" t.integer "permission_id" + t.index ["member_id", "permission_id"], name: "index_members_permissions_on_member_id_and_permission_id" end - add_index "members_permissions", ["member_id", "permission_id"], name: "index_members_permissions_on_member_id_and_permission_id", using: :btree - create_table "members_roles", id: false, force: :cascade do |t| t.integer "member_id" t.integer "role_id" + t.index ["member_id", "role_id"], name: "index_members_roles_on_member_id_and_role_id" + t.index ["member_id"], name: "index_members_roles_on_member_id" end - add_index "members_roles", ["member_id", "role_id"], name: "index_members_roles_on_member_id_and_role_id", using: :btree - add_index "members_roles", ["member_id"], name: "index_members_roles_on_member_id", using: :btree - - create_table "permissions", force: :cascade do |t| - t.string "name" - t.integer "resource_id" - t.string "resource_type" + create_table "permissions", id: :serial, force: :cascade do |t| + t.string "name" + t.string "resource_type" + t.integer "resource_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["name", "resource_type", "resource_id"], name: "index_permissions_on_name_and_resource_type_and_resource_id" + t.index ["name"], name: "index_permissions_on_name" end - add_index "permissions", ["name", "resource_type", "resource_id"], name: "index_permissions_on_name_and_resource_type_and_resource_id", using: :btree - add_index "permissions", ["name"], name: "index_permissions_on_name", using: :btree - - create_table "roles", force: :cascade do |t| - t.string "name" - t.string "description" + create_table "roles", id: :serial, force: :cascade do |t| + t.string "name" + t.string "description" t.datetime "created_at" t.datetime "updated_at" end - create_table "sponsors", force: :cascade do |t| - t.string "name" - t.text "description" + create_table "sponsors", id: :serial, force: :cascade do |t| + t.string "name" + t.text "description" t.datetime "created_at" t.datetime "updated_at" - t.string "avatar" - t.string "website" - t.integer "seats", default: 15 - t.string "image_cache" - t.integer "number_of_coaches" - t.text "accessibility_info" - t.integer "level", default: 1, null: false + t.string "avatar" + t.string "website" + t.integer "seats", default: 15 + t.string "image_cache" + t.integer "number_of_coaches" + t.text "accessibility_info" + t.integer "level", default: 1, null: false end - create_table "sponsorships", force: :cascade do |t| - t.integer "event_id" - t.integer "sponsor_id" + create_table "sponsorships", id: :serial, force: :cascade do |t| + t.integer "event_id" + t.integer "sponsor_id" t.datetime "created_at" t.datetime "updated_at" - t.string "level" + t.string "level" + t.index ["event_id"], name: "index_sponsorships_on_event_id" + t.index ["sponsor_id"], name: "index_sponsorships_on_sponsor_id" end - add_index "sponsorships", ["event_id"], name: "index_sponsorships_on_event_id", using: :btree - add_index "sponsorships", ["sponsor_id"], name: "index_sponsorships_on_sponsor_id", using: :btree - - create_table "subscriptions", force: :cascade do |t| - t.integer "group_id" - t.integer "member_id" + create_table "subscriptions", id: :serial, force: :cascade do |t| + t.integer "group_id" + t.integer "member_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["group_id"], name: "index_subscriptions_on_group_id" + t.index ["member_id"], name: "index_subscriptions_on_member_id" end - add_index "subscriptions", ["group_id"], name: "index_subscriptions_on_group_id", using: :btree - add_index "subscriptions", ["member_id"], name: "index_subscriptions_on_member_id", using: :btree - - create_table "taggings", force: :cascade do |t| - t.integer "tag_id" - t.integer "taggable_id" - t.string "taggable_type" - t.integer "tagger_id" - t.string "tagger_type" - t.string "context", limit: 128 + create_table "taggings", id: :serial, force: :cascade do |t| + t.integer "tag_id" + t.string "taggable_type" + t.integer "taggable_id" + t.string "tagger_type" + t.integer "tagger_id" + t.string "context", limit: 128 t.datetime "created_at" + t.string "tenant", limit: 128 + t.index ["context"], name: "index_taggings_on_context" + t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true + t.index ["tag_id"], name: "index_taggings_on_tag_id" + t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context" + t.index ["taggable_id", "taggable_type", "tagger_id", "context"], name: "taggings_idy" + t.index ["taggable_id"], name: "index_taggings_on_taggable_id" + t.index ["taggable_type"], name: "index_taggings_on_taggable_type" + t.index ["tagger_id", "tagger_type"], name: "index_taggings_on_tagger_id_and_tagger_type" + t.index ["tagger_id"], name: "index_taggings_on_tagger_id" + t.index ["tenant"], name: "index_taggings_on_tenant" end - add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree - add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree - - create_table "tags", force: :cascade do |t| - t.string "name" + create_table "tags", id: :serial, force: :cascade do |t| + t.string "name" t.integer "taggings_count", default: 0 + t.index ["name"], name: "index_tags_on_name", unique: true end - add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree - - create_table "testimonials", force: :cascade do |t| - t.integer "member_id" - t.text "text" + create_table "testimonials", id: :serial, force: :cascade do |t| + t.integer "member_id" + t.text "text" t.datetime "created_at" t.datetime "updated_at" + t.index ["member_id"], name: "index_testimonials_on_member_id" end - add_index "testimonials", ["member_id"], name: "index_testimonials_on_member_id", using: :btree - - create_table "tutorials", force: :cascade do |t| - t.string "title" - t.text "description" - t.string "url" - t.integer "workshop_id" + create_table "tutorials", id: :serial, force: :cascade do |t| + t.string "title" + t.text "description" + t.string "url" + t.integer "workshop_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["workshop_id"], name: "index_tutorials_on_workshop_id" end - add_index "tutorials", ["workshop_id"], name: "index_tutorials_on_workshop_id", using: :btree - - create_table "waiting_lists", force: :cascade do |t| - t.integer "invitation_id" - t.boolean "auto_rsvp", default: true + create_table "waiting_lists", id: :serial, force: :cascade do |t| + t.integer "invitation_id" + t.boolean "auto_rsvp", default: true t.datetime "created_at" t.datetime "updated_at" + t.index ["invitation_id"], name: "index_waiting_lists_on_invitation_id" end - add_index "waiting_lists", ["invitation_id"], name: "index_waiting_lists_on_invitation_id", using: :btree - - create_table "workshop_invitations", force: :cascade do |t| - t.integer "workshop_id" - t.integer "member_id" - t.boolean "attending" - t.boolean "attended" - t.text "note" + create_table "workshop_invitations", id: :serial, force: :cascade do |t| + t.integer "workshop_id" + t.integer "member_id" + t.boolean "attending" + t.boolean "attended" + t.text "note" t.datetime "created_at" t.datetime "updated_at" - t.string "token" - t.string "role" + t.string "token" + t.string "role" t.datetime "reminded_at" t.datetime "rsvp_time" - t.boolean "automated_rsvp" - t.text "tutorial" + t.boolean "automated_rsvp" + t.text "tutorial" + t.index ["member_id"], name: "index_workshop_invitations_on_member_id" + t.index ["token"], name: "index_workshop_invitations_on_token", unique: true + t.index ["workshop_id"], name: "index_workshop_invitations_on_workshop_id" end - add_index "workshop_invitations", ["member_id"], name: "index_workshop_invitations_on_member_id", using: :btree - add_index "workshop_invitations", ["token"], name: "index_workshop_invitations_on_token", unique: true, using: :btree - add_index "workshop_invitations", ["workshop_id"], name: "index_workshop_invitations_on_workshop_id", using: :btree - - create_table "workshop_sponsors", force: :cascade do |t| - t.integer "sponsor_id" - t.integer "workshop_id" - t.boolean "host", default: false + create_table "workshop_sponsors", id: :serial, force: :cascade do |t| + t.integer "sponsor_id" + t.integer "workshop_id" + t.boolean "host", default: false t.datetime "created_at" t.datetime "updated_at" + t.index ["sponsor_id"], name: "index_workshop_sponsors_on_sponsor_id" + t.index ["workshop_id"], name: "index_workshop_sponsors_on_workshop_id" end - add_index "workshop_sponsors", ["sponsor_id"], name: "index_workshop_sponsors_on_sponsor_id", using: :btree - add_index "workshop_sponsors", ["workshop_id"], name: "index_workshop_sponsors_on_workshop_id", using: :btree - - create_table "workshops", force: :cascade do |t| - t.string "title" - t.text "description" + create_table "workshops", id: :serial, force: :cascade do |t| + t.string "title" + t.text "description" t.datetime "date_and_time" t.datetime "created_at" t.datetime "updated_at" - t.boolean "invitable", default: true - t.string "sign_up_url" - t.integer "chapter_id" + t.boolean "invitable", default: true + t.string "sign_up_url" + t.integer "chapter_id" t.datetime "rsvp_closes_at" t.datetime "rsvp_opens_at" t.datetime "ends_at" - t.boolean "virtual", default: false - t.integer "student_spaces", default: 0 - t.integer "coach_spaces", default: 0 - t.string "slack_channel" - t.string "slack_channel_link" + t.boolean "virtual", default: false + t.integer "student_spaces", default: 0 + t.integer "coach_spaces", default: 0 + t.string "slack_channel" + t.string "slack_channel_link" + t.index ["chapter_id"], name: "index_workshops_on_chapter_id" end - add_index "workshops", ["chapter_id"], name: "index_workshops_on_chapter_id", using: :btree - end diff --git a/db/seeds.rb b/db/seeds.rb index 14d4ea247..2328d1926 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,7 +1,7 @@ if Rails.env.development? begin Rails.logger.info 'Running migrations...' - Planner::Application.config.log_level = :info + Rails.application.config.log_level = :info Rails.logger.info "Creating chapters..." chapters = ['London', 'Brighton', 'Cambridge', 'Barcelona', 'Paris', 'Merlbourne', 'Berlin', 'New York'].map do |name| Fabricate(:chapter_with_groups, name: name) @@ -20,7 +20,7 @@ workshops.concat Fabricate.times(2, :workshop, title: 'Workshop', chapter: chapters.sample) Rails.logger.info "Creating a lot of old workshops..." - past_workshops = 100.times.map do |n| + past_workshops = 50.times.map do |n| Fabricate(:workshop, title: 'Workshop', chapter: chapters.sample, date_and_time: Time.zone.now - 9.years + n.months) @@ -41,7 +41,7 @@ end Rails.logger.info "Creating coaches..." - coaches = 200.times.map { Fabricate(:coach, groups: Group.coaches.order('RANDOM()').limit(2)) } + coaches = 50.times.map { Fabricate(:coach, groups: Group.coaches.order('RANDOM()').limit(2)) } tutorials = Fabricate.times(20, :tutorial) 30.times { Fabricate(:feedback_request, workshop: past_workshops.sample) } 20.times { Fabricate(:feedback, tutorial: tutorials.sample, coach: coaches.sample) } @@ -64,13 +64,8 @@ Wonka ] - Rails.logger.info "Creating jobs..." - 15.times do |n| - Fabricate(:job, title: job_titles.sample, company: job_companies.sample, expiry_date: Time.zone.today + 3.weeks - n.weeks) - end - Rails.logger.info "Creating students..." - students = 200.times.map { Fabricate(:student, groups: Group.students.order('RANDOM()').limit(2)) } + students = 50.times.map { Fabricate(:student, groups: Group.students.order('RANDOM()').limit(2)) } Rails.logger.info "Creating event invitations..." 10.times do |n| @@ -79,7 +74,7 @@ end Rails.logger.info "Creating workshop invitations..." - 300.times do |n| + 30.times do |n| Fabricate(:coach_workshop_invitation, member: coaches.sample, workshop: workshops.sample) rescue nil Fabricate(:student_workshop_invitation, member: students.sample, workshop: workshops.sample) rescue nil end diff --git a/docker-compose.yml b/docker-compose.yml index 443ded3e1..55c27f50b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,21 +10,17 @@ services: env_file: - docker-compose.env build: . - command: - - bundle - - exec - - rails - - server - - --binding=0.0.0.0 - - --port=3000 + command: tail -f /dev/null environment: DB_HOST: db volumes: - .:/planner + - gem_cache:/usr/local/bundle/gems ports: - 3000:3000 depends_on: - db volumes: - db_data: {} + db_data: + gem_cache: diff --git a/lib/verifier.rb b/lib/verifier.rb index 00800b467..b2534619b 100644 --- a/lib/verifier.rb +++ b/lib/verifier.rb @@ -20,7 +20,7 @@ def verify(model) private def verifier - @verifier ||= ActiveSupport::MessageVerifier.new(Planner::Application.config.secret_token) + @verifier ||= ActiveSupport::MessageVerifier.new(Rails.application.config.secret_key_base) end def generate_access_token diff --git a/native-installation-instructions.md b/native-installation-instructions.md index 3e1bf268c..b4f787d98 100644 --- a/native-installation-instructions.md +++ b/native-installation-instructions.md @@ -21,15 +21,15 @@ You will need to install Ruby 2.7.2 using RVM or rbenv. ### Option 1: Using [rvm](https://rvm.io/rvm/install) ```bash -CPPFLAGS=-DUSE_FFI_CLOSURE_ALLOC rvm install 2.5.9 +CPPFLAGS=-DUSE_FFI_CLOSURE_ALLOC rvm install 2.7.2 ``` -We need to set the CPPFLAGS env variable to be able to install Ruby 2.5.9 on M1 Mac machines. See more: [https://github.com/ffi/ffi/issues/869#issuecomment-1233000037](https://github.com/ffi/ffi/issues/869#issuecomment-1233000037) +We need to set the CPPFLAGS env variable to be able to install Ruby 2.7.2 on M1 Mac machines. See more: [https://github.com/ffi/ffi/issues/869#issuecomment-1233000037](https://github.com/ffi/ffi/issues/869#issuecomment-1233000037) ### Option 2: Using [rbenv](https://github.com/sstephenson/rbenv) and [ruby-build](https://github.com/sstephenson/ruby-build) ```bash -rbenv install 2.5.9 -rbenv global 2.5.9 +rbenv install 2.7.2 +rbenv global 2.7.2 ``` ## Install and run PostgreSQL diff --git a/spec/controllers/admin/invitations_controller_spec.rb b/spec/controllers/admin/invitations_controller_spec.rb index 9fb0a69d0..f56cde0b1 100644 --- a/spec/controllers/admin/invitations_controller_spec.rb +++ b/spec/controllers/admin/invitations_controller_spec.rb @@ -16,7 +16,7 @@ end it "Successfuly updates an invitation" do - put :update, id: invitation.token, workshop_id: workshop.id, attending: "true" + put :update, params: { id: invitation.token, workshop_id: workshop.id, attending: "true" } expect(invitation.reload.attending).to be true expect(flash[:notice]).to match("You have added") @@ -26,7 +26,7 @@ # Trigger an error when trying to update the `attending` attribute invitation.update_attribute(:tutorial, nil) - put :update, id: invitation.token, workshop_id: workshop.id, attending: "true" + put :update, params: { id: invitation.token, workshop_id: workshop.id, attending: "true" } # State didn't change and we have an error message explaining why expect(invitation.reload.attending).to be_nil diff --git a/spec/controllers/admin/member_notes_controller_spec.rb b/spec/controllers/admin/member_notes_controller_spec.rb index 004a9ebb2..35f9b0a0d 100644 --- a/spec/controllers/admin/member_notes_controller_spec.rb +++ b/spec/controllers/admin/member_notes_controller_spec.rb @@ -8,7 +8,7 @@ describe 'POST #create' do it "Doesn't allow anonymous users to create notes" do expect do - post :create, member_note: { note: member_note.note, member_id: member.id } + post :create, params: { member_note: { note: member_note.note, member_id: member.id } } end.not_to change { MemberNote.all.count } end @@ -16,7 +16,7 @@ login member expect do - post :create, member_note: { note: member_note.note, member_id: member.id } + post :create, params: { member_note: { note: member_note.note, member_id: member.id } } end.not_to change { MemberNote.all.count } end @@ -25,13 +25,13 @@ request.env['HTTP_REFERER'] = '/admin/member/3' expect do - post :create, member_note: { note: member_note.note, member_id: member.id } + post :create, params: { member_note: { note: member_note.note, member_id: member.id } } end.to change { MemberNote.all.count }.by 1 end it "Doesn't allow blank notes to be created" do expect do - post :create, member_note: { note: ' ', member_id: member.id } + post :create, params: { member_note: { note: ' ', member_id: member.id } } end.not_to change { MemberNote.all.count } end end diff --git a/spec/controllers/admin/sponsors_controller_spec.rb b/spec/controllers/admin/sponsors_controller_spec.rb index f5235628b..a97de114d 100644 --- a/spec/controllers/admin/sponsors_controller_spec.rb +++ b/spec/controllers/admin/sponsors_controller_spec.rb @@ -11,9 +11,11 @@ describe 'POST #create' do it "Doesn't allow anonymous users to create sponsors" do expect do - post :create, sponsor: { - name: 'name', website: 'https://example.com', seats: 40, - address: address, avatar: avatar, members: [1, 2] + post :create, params: { + sponsor: { + name: 'name', website: 'https://example.com', seats: 40, + address: address, avatar: avatar, members: [1, 2] + } } end.to change(Sponsor, :count).by(0) end @@ -22,9 +24,11 @@ login member expect do - post :create, sponsor: { - name: 'name', website: 'https://example.com', seats: 40, - address: address, avatar: avatar + post :create, params: { + sponsor: { + name: 'name', website: 'https://example.com', seats: 40, + address: address, avatar: avatar + } } end.to change(Sponsor, :count).by(0) end @@ -35,9 +39,11 @@ request.env['HTTP_REFERER'] = '/admin/member/3' expect do - post :create, sponsor: { - name: 'name', website: 'https://example.com', seats: 40, - address: address, avatar: avatar + post :create, params: { + sponsor: { + name: 'name', website: 'https://example.com', seats: 40, + address: address, avatar: avatar + } } end.to change(Sponsor, :count).by(1) end @@ -47,9 +53,11 @@ request.env['HTTP_REFERER'] = '/admin/member/3' expect do - post :create, sponsor: { - name: 'name', website: 'https://example.com', seats: 40, - address: address, avatar: avatar, contact_ids: [member.id, member1.id] + post :create, params: { + sponsor: { + name: 'name', website: 'https://example.com', seats: 40, + address: address, avatar: avatar, contact_ids: [member.id, member1.id] + } } end.to change(Sponsor, :count).by(1) end @@ -59,9 +67,11 @@ request.env['HTTP_REFERER'] = '/admin/member/3' expect do - post :create, sponsor: { - name: 'name', website: 'https://example.com', seats: 40, - address: address, avatar: avatar, contact_ids: [member.id, member1.id] + post :create, params: { + sponsor: { + name: 'name', website: 'https://example.com', seats: 40, + address: address, avatar: avatar, contact_ids: [member.id, member1.id] + } } end.to change(Sponsor, :count).by(1) end @@ -71,10 +81,12 @@ request.env['HTTP_REFERER'] = '/admin/member/3' expect do - post :create, sponsor: { - name: 'name', website: 'https://example.com', seats: 40, - address: Fabricate(:address, latitude: '54.47474', longitude: '-0.12345'), - avatar: avatar, members: [] + post :create, params: { + sponsor: { + name: 'name', website: 'https://example.com', seats: 40, + address: Fabricate(:address, latitude: '54.47474', longitude: '-0.12345'), + avatar: avatar, members: [] + } } end.to change(Sponsor, :count).by(1) end @@ -82,9 +94,11 @@ it "Doesn't allow blank sponsors to be created" do expect do - post :create, sponsor: { - name: '', website: '', seats: '', - address: '', avatar: '', members: [] + post :create, params: { + sponsor: { + name: '', website: '', seats: '', + address: '', avatar: '', members: [] + } } end.to change(Sponsor, :count).by(0) end @@ -92,8 +106,10 @@ describe 'POST #update' do it "Doesn't allow anonymous users to update sponsors" do - post :update, id: sponsor.id, sponsor: { - name: 'new name' + post :update, params: { + id: sponsor.id, sponsor: { + name: 'new name' + } } expect(sponsor.reload.name).to eq sponsor.name end @@ -101,8 +117,10 @@ it "Doesn't allow regular users to update sponsors" do login member - post :update, id: sponsor.id, sponsor: { - name: 'new_name' + post :update, params: { + id: sponsor.id, sponsor: { + name: 'new_name' + } } expect(sponsor.reload.name).to eq sponsor.name end @@ -112,8 +130,10 @@ login admin request.env['HTTP_REFERER'] = '/admin/member/3' - post :update, id: sponsor.id, sponsor: { - name: 'new_name' + post :update, params: { + id: sponsor.id, sponsor: { + name: 'new_name' + } } expect(sponsor.reload.name).to eq sponsor.name end diff --git a/spec/controllers/admin/workshops_controller_spec.rb b/spec/controllers/admin/workshops_controller_spec.rb index 6371f00a2..5fc46e6c5 100644 --- a/spec/controllers/admin/workshops_controller_spec.rb +++ b/spec/controllers/admin/workshops_controller_spec.rb @@ -17,12 +17,12 @@ context "workshop deletion tried within specific time frame since it's creation" do it 'should not delete the workshop' do expect do - delete :destroy, id: workshop.id + delete :destroy, params: { id: workshop.id } end.not_to change { Workshop.count } end it "should display workshop can't be deleted related flash message" do - delete :destroy, id: workshop.id + delete :destroy, params: { id: workshop.id } expect(flash[:notice]).to eq(I18n.t('admin.workshop.destroy.failure')) end @@ -35,7 +35,7 @@ travel new_current_time do expect do - delete :destroy, id: workshop.id + delete :destroy, params: { id: workshop.id } end.not_to change { Workshop.count } end end @@ -45,7 +45,7 @@ WORKSHOP_DELETION_TIME_FRAME_SINCE_CREATION travel new_current_time do - delete :destroy, id: workshop.id + delete :destroy, params: { id: workshop.id } end expect(flash[:notice]).to eq(I18n.t('admin.workshop.destroy.failure')) @@ -57,12 +57,12 @@ context "workshop deletion tried within specific time frame since it's creation" do it 'should successfully delete the workshop' do expect do - delete :destroy, id: workshop.id + delete :destroy, params: { id: workshop.id } end.to change { Workshop.count }.by -1 end it 'should display workshop deleted successfully related flash message' do - delete :destroy, id: workshop.id + delete :destroy, params: { id: workshop.id } expect(flash[:notice]).to eq(I18n.t('admin.workshop.destroy.success')) end @@ -75,7 +75,7 @@ travel new_current_time do expect do - delete :destroy, id: workshop.id + delete :destroy, params: { id: workshop.id } end.not_to change { Workshop.count } end end @@ -85,7 +85,7 @@ WORKSHOP_DELETION_TIME_FRAME_SINCE_CREATION travel new_current_time do - delete :destroy, id: workshop.id + delete :destroy, params: { id: workshop.id } end expect(flash[:notice]).to eq(I18n.t('admin.workshop.destroy.failure')) diff --git a/spec/controllers/members_controller_spec.rb b/spec/controllers/members_controller_spec.rb index e5edabb78..7d2e283a9 100644 --- a/spec/controllers/members_controller_spec.rb +++ b/spec/controllers/members_controller_spec.rb @@ -4,12 +4,12 @@ describe "GET unsubscribe/#token" do it "redirects to the subscription path when token is valid" do member = Fabricate(:member) - get :unsubscribe, token: member_token(member) + get :unsubscribe, params: { token: member_token(member) } expect(response).to redirect_to(subscriptions_path) end it "redirects to the root path when token is invalid" do - get :unsubscribe, token: "foo" + get :unsubscribe, params: { token: "foo" } expect(response).to redirect_to(root_path) expect(flash[:notice]).to eq("Your token is invalid. ") end diff --git a/spec/fabricators/chapter_fabricator.rb b/spec/fabricators/chapter_fabricator.rb index 56f825efa..c76632eba 100644 --- a/spec/fabricators/chapter_fabricator.rb +++ b/spec/fabricators/chapter_fabricator.rb @@ -6,7 +6,7 @@ email { Faker::Internet.email } time_zone { 'London' } - after_save do |chapter| + after_create do |chapter| member = Fabricate(:member) member.add_role :organiser, chapter end @@ -18,7 +18,7 @@ email { Faker::Internet.email } time_zone { 'London' } - after_save do |chapter| + after_create do |chapter| Fabricate(:students, chapter: chapter) Fabricate(:coaches, chapter: chapter) end diff --git a/spec/fabricators/member_fabricator.rb b/spec/fabricators/member_fabricator.rb index db74888de..df138e691 100644 --- a/spec/fabricators/member_fabricator.rb +++ b/spec/fabricators/member_fabricator.rb @@ -31,7 +31,7 @@ end Fabricator(:chapter_organiser, from: :member) do - after_save do |member| + after_create do |member| chapter = Fabricate(:chapter) member.add_role :organiser, chapter end diff --git a/spec/features/admin/manage_workshop_attendances_spec.rb b/spec/features/admin/manage_workshop_attendances_spec.rb index abb208679..6c5b05b42 100644 --- a/spec/features/admin/manage_workshop_attendances_spec.rb +++ b/spec/features/admin/manage_workshop_attendances_spec.rb @@ -50,9 +50,7 @@ expect(page).to have_content('1 are attending as students') expect(page).to_not have_selector('i.fa-magic') - # Unclear why this has to be done twice, when tested manually it works - # the first time. - 2.times { find('span', text: 'Select a member to RSVP').click } + find('span', text: 'Select a member to RSVP').click find("li", text: "#{other_invitation.member.full_name} (#{other_invitation.role})").click expect(page).to have_content('2 are attending as students') diff --git a/spec/features/viewing_pages_spec.rb b/spec/features/viewing_pages_spec.rb index f8ee7d65d..e2762882d 100644 --- a/spec/features/viewing_pages_spec.rb +++ b/spec/features/viewing_pages_spec.rb @@ -14,4 +14,5 @@ click_on 'Privacy Policy' expect(page).to have_content('Your privacy means a lot to us') end + end diff --git a/spec/lib/services/mailing_list_spec.rb b/spec/lib/services/mailing_list_spec.rb index 94bb25f91..8d455170f 100644 --- a/spec/lib/services/mailing_list_spec.rb +++ b/spec/lib/services/mailing_list_spec.rb @@ -8,6 +8,7 @@ let(:members) { double(:members) } before do + allow(ENV).to receive(:[]).and_call_original allow(ENV).to receive(:[]).with('MAILCHIMP_KEY').and_return('test') allow(mailing_list).to receive(:client).and_return(client) allow(Rails).to receive(:env).and_return("production".inquiry) diff --git a/spec/lib/tasks/mailing_list_rake_spec.rb b/spec/lib/tasks/mailing_list_rake_spec.rb index 8b5c7115a..ec7b884c6 100644 --- a/spec/lib/tasks/mailing_list_rake_spec.rb +++ b/spec/lib/tasks/mailing_list_rake_spec.rb @@ -6,6 +6,8 @@ end it 'should run gracefully' do + # See https://stackoverflow.com/questions/23146353/rspec-3-0-how-to-mock-a-method-replacing-the-parameter-but-with-no-return-value + allow(ENV).to receive(:[]).and_call_original allow(ENV).to receive(:[]).with('NEWSLETTER_ID').and_return('newsletterid') expect { task.invoke }.to_not raise_error end diff --git a/spec/lib/verifier_spec.rb b/spec/lib/verifier_spec.rb index 1213e0d84..a73d44ef4 100644 --- a/spec/lib/verifier_spec.rb +++ b/spec/lib/verifier_spec.rb @@ -3,7 +3,7 @@ RSpec.describe Verifier do before do - Planner::Application.config.secret_token = '123' + Rails.application.config.secret_key_base = '123' end it 'generates access_token for an id' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0acc9700f..5a24600a1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -90,6 +90,22 @@ def self.branch_coverage? DatabaseCleaner.clean end + + config.after do |example| + # Take a screenshot if the example failed and JavaScript is enabled + if example.exception && defined?(page) && Capybara.current_driver == :selenium + # Get the filename and line number of the failing spec + location = example.metadata[:location] + filename, line_number = location.split(':') + + # Build a custom filename for the screenshot + screenshot_filename = "#{filename}:#{line_number}.png" + + # Save the screenshot using the custom filename + page.save_screenshot(screenshot_filename, full: true) + end + end + config.example_status_persistence_file_path = 'tmp/spec_failures' if Bullet.enable? diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index e44bb7d0d..7e676bbd0 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -1,5 +1,8 @@ require 'webdrivers' +# Temporary fix for https://github.com/titusfortner/webdrivers/issues/247 +Webdrivers::Chromedriver.required_version = "114.0.5735.90" + Capybara.register_driver :chrome do |app| options = Selenium::WebDriver::Chrome::Options.new