From 26a718a90c71abd76864e77734bd08f53ff9829e Mon Sep 17 00:00:00 2001 From: echarp Date: Sat, 27 May 2017 09:34:24 +0200 Subject: [PATCH] Bundle update and ApplicationRecord as required in rails 5.1+ --- .rubocop.yml | 4 ---- Gemfile.lock | 16 +++++++++------- app/models/admin_user.rb | 2 +- app/models/application_record.rb | 4 ++++ app/models/city.rb | 2 +- app/models/event.rb | 2 +- app/models/kind.rb | 2 +- app/models/note.rb | 2 +- app/models/orga.rb | 2 +- app/models/region.rb | 2 +- app/models/user.rb | 2 +- 11 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 app/models/application_record.rb diff --git a/.rubocop.yml b/.rubocop.yml index b5206fde..576aca0f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -7,7 +7,3 @@ BlockLength: - config/routes.rb Rails/HttpPositionalArguments: Enabled: false -# https://github.com/bbatsov/rubocop/issues/4189 -# TODO remove once rubocopy has changed beyond 0.48.1 -Lint/AmbiguousBlockAssociation: - Enabled: false diff --git a/Gemfile.lock b/Gemfile.lock index e28cc485..7bfb8382 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://github.com/activeadmin/activeadmin.git - revision: 8f7f58016802cd5a7f663fbc80b90b884252f939 + revision: d941aaa88c6e9011f7e9d1c7d85b2cd871160f0f specs: activeadmin (1.0.0) arbre (>= 1.1.1) @@ -72,8 +72,8 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - acts-as-taggable-on (4.0.0) - activerecord (>= 4.0) + acts-as-taggable-on (5.0.0) + activerecord (>= 4.2.8) addressable (2.5.1) public_suffix (~> 2.0, >= 2.0.2) arbre (1.1.1) @@ -92,9 +92,9 @@ GEM thor (~> 0.18) byebug (9.0.6) coderay (1.1.1) - coffee-rails (4.2.1) + coffee-rails (4.2.2) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.2.x) + railties (>= 4.0.0) coffee-script (2.4.1) coffee-script-source execjs @@ -268,6 +268,7 @@ GEM paper_trail (7.0.2) activerecord (>= 4.0, < 5.2) request_store (~> 1.1) + parallel (1.11.2) parser (2.4.0.0) ast (~> 2.2) piwik_analytics (1.0.2) @@ -338,7 +339,8 @@ GEM responders (2.4.0) actionpack (>= 4.2.0, < 5.3) railties (>= 4.2.0, < 5.3) - rubocop (0.48.1) + rubocop (0.49.0) + parallel (~> 1.10) parser (>= 2.3.3.1, < 3.0) powerpack (~> 0.1) rainbow (>= 1.99.1, < 3.0) @@ -389,7 +391,7 @@ GEM thor (0.19.4) thread_safe (0.3.6) tilt (2.0.7) - tinymce-rails (4.6.1) + tinymce-rails (4.6.2) railties (>= 3.1.1) tinymce-rails-langs (4.20160310) tinymce-rails (~> 4.1, >= 4.1.10) diff --git a/app/models/admin_user.rb b/app/models/admin_user.rb index a7a554e0..a78df7d1 100644 --- a/app/models/admin_user.rb +++ b/app/models/admin_user.rb @@ -1,5 +1,5 @@ # The new agenda moderators, from active_admin -class AdminUser < ActiveRecord::Base +class AdminUser < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 00000000..23c70da4 --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,4 @@ +# Base domain class +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/app/models/city.rb b/app/models/city.rb index 068451f0..9bf0cd0c 100644 --- a/app/models/city.rb +++ b/app/models/city.rb @@ -2,7 +2,7 @@ # # It is mainly used to manage coordinates # -class City < ActiveRecord::Base +class City < ApplicationRecord has_many :events, foreign_key: :city, primary_key: :name has_many :orgas, foreign_key: :city, primary_key: :name end diff --git a/app/models/event.rb b/app/models/event.rb index 11d93bbe..5d0ee205 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -1,7 +1,7 @@ require 'schedule' # This is the central ADL class, where are managed all events -class Event < ActiveRecord::Base +class Event < ApplicationRecord extend SimpleCalendar include Schedule acts_as_taggable diff --git a/app/models/kind.rb b/app/models/kind.rb index 3958ef59..79a7d575 100644 --- a/app/models/kind.rb +++ b/app/models/kind.rb @@ -1,4 +1,4 @@ # Gives the possibility to organise organisations! :) -class Kind < ActiveRecord::Base +class Kind < ApplicationRecord has_many :orgas end diff --git a/app/models/note.rb b/app/models/note.rb index f91a38b9..efb07df7 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -1,5 +1,5 @@ # Manages data related to events' moderation -class Note < ActiveRecord::Base +class Note < ApplicationRecord belongs_to :event belongs_to :author, class_name: User diff --git a/app/models/orga.rb b/app/models/orga.rb index d4893a05..bb0176b1 100644 --- a/app/models/orga.rb +++ b/app/models/orga.rb @@ -1,5 +1,5 @@ # Organisations related to this agenda -class Orga < ActiveRecord::Base +class Orga < ApplicationRecord acts_as_taggable strip_attributes has_paper_trail ignore: %i[last_updated secret submitter decision_time diff --git a/app/models/region.rb b/app/models/region.rb index b5a87c52..ef6fa540 100644 --- a/app/models/region.rb +++ b/app/models/region.rb @@ -1,5 +1,5 @@ # This is mostly to group events around a region -class Region < ActiveRecord::Base +class Region < ApplicationRecord belongs_to :region has_many :regions diff --git a/app/models/user.rb b/app/models/user.rb index 5895cf8a..39cbcf29 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,7 +2,7 @@ require 'digest/md5' # Moderators, but using a failed pwd mechanism # TODO, migrate to full active_admin -class User < ActiveRecord::Base +class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, authentication_keys: [:login]