From 7ab602175a43e8739e09714be963e49511c8788c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Thu, 22 Jun 2017 14:16:09 +0200 Subject: [PATCH] makes models inherit from ApplicationRecord --- app/models/budget.rb | 2 +- app/models/budget/ballot.rb | 2 +- app/models/budget/ballot/line.rb | 2 +- app/models/budget/group.rb | 2 +- app/models/budget/heading.rb | 2 +- app/models/budget/investment.rb | 2 +- app/models/budget/reclassified_vote.rb | 2 +- app/models/budget/valuator_assignment.rb | 2 +- app/models/legislation/annotation.rb | 2 +- app/models/legislation/answer.rb | 2 +- app/models/legislation/draft_version.rb | 2 +- app/models/legislation/process.rb | 2 +- app/models/legislation/question.rb | 2 +- app/models/legislation/question_option.rb | 2 +- app/models/poll.rb | 2 +- app/models/poll/answer.rb | 2 +- app/models/poll/booth.rb | 2 +- app/models/poll/booth_assignment.rb | 2 +- app/models/poll/officer.rb | 2 +- app/models/poll/officer_assignment.rb | 2 +- app/models/poll/partial_result.rb | 2 +- app/models/poll/question.rb | 2 +- app/models/poll/recount.rb | 2 +- app/models/poll/voter.rb | 2 +- app/models/signature.rb | 2 +- app/models/signature_sheet.rb | 2 +- app/models/site_customization/content_block.rb | 2 +- app/models/site_customization/image.rb | 2 +- app/models/site_customization/page.rb | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/app/models/budget.rb b/app/models/budget.rb index ae589302f..8c34e030d 100644 --- a/app/models/budget.rb +++ b/app/models/budget.rb @@ -1,4 +1,4 @@ -class Budget < ActiveRecord::Base +class Budget < ApplicationRecord include Measurable include Sluggable diff --git a/app/models/budget/ballot.rb b/app/models/budget/ballot.rb index 27b0d9100..9539119b0 100644 --- a/app/models/budget/ballot.rb +++ b/app/models/budget/ballot.rb @@ -1,5 +1,5 @@ class Budget - class Ballot < ActiveRecord::Base + class Ballot < ApplicationRecord belongs_to :user belongs_to :budget belongs_to :poll_ballot, class_name: "Poll::Ballot" diff --git a/app/models/budget/ballot/line.rb b/app/models/budget/ballot/line.rb index 2d75c1cd4..54b26f4b4 100644 --- a/app/models/budget/ballot/line.rb +++ b/app/models/budget/ballot/line.rb @@ -1,6 +1,6 @@ class Budget class Ballot - class Line < ActiveRecord::Base + class Line < ApplicationRecord belongs_to :ballot belongs_to :investment, counter_cache: :ballot_lines_count belongs_to :heading diff --git a/app/models/budget/group.rb b/app/models/budget/group.rb index a95d7ea27..d77c840c0 100644 --- a/app/models/budget/group.rb +++ b/app/models/budget/group.rb @@ -1,5 +1,5 @@ class Budget - class Group < ActiveRecord::Base + class Group < ApplicationRecord include Sluggable translates :name, touch: true diff --git a/app/models/budget/heading.rb b/app/models/budget/heading.rb index 40a534f55..0b94aac67 100644 --- a/app/models/budget/heading.rb +++ b/app/models/budget/heading.rb @@ -1,5 +1,5 @@ class Budget - class Heading < ActiveRecord::Base + class Heading < ApplicationRecord OSM_DISTRICT_LEVEL_ZOOM = 12.freeze include Sluggable diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb index c3842dc94..2eaf801c1 100644 --- a/app/models/budget/investment.rb +++ b/app/models/budget/investment.rb @@ -1,5 +1,5 @@ class Budget - class Investment < ActiveRecord::Base + class Investment < ApplicationRecord SORTING_OPTIONS = {id: "id", title: "title", supports: "cached_votes_up"}.freeze include Rails.application.routes.url_helpers diff --git a/app/models/budget/reclassified_vote.rb b/app/models/budget/reclassified_vote.rb index 0eb44d8cc..3f11aa388 100644 --- a/app/models/budget/reclassified_vote.rb +++ b/app/models/budget/reclassified_vote.rb @@ -1,5 +1,5 @@ class Budget - class ReclassifiedVote < ActiveRecord::Base + class ReclassifiedVote < ApplicationRecord REASONS = %w(heading_changed unfeasible) belongs_to :user diff --git a/app/models/budget/valuator_assignment.rb b/app/models/budget/valuator_assignment.rb index 18ef73812..9f60caf1e 100644 --- a/app/models/budget/valuator_assignment.rb +++ b/app/models/budget/valuator_assignment.rb @@ -1,5 +1,5 @@ class Budget - class ValuatorAssignment < ActiveRecord::Base + class ValuatorAssignment < ApplicationRecord belongs_to :valuator, counter_cache: :budget_investments_count belongs_to :investment, counter_cache: true end diff --git a/app/models/legislation/annotation.rb b/app/models/legislation/annotation.rb index 5cb190cc2..93a6c1acf 100644 --- a/app/models/legislation/annotation.rb +++ b/app/models/legislation/annotation.rb @@ -1,4 +1,4 @@ -class Legislation::Annotation < ActiveRecord::Base +class Legislation::Annotation < ApplicationRecord COMMENTS_PAGE_SIZE = 5 acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases diff --git a/app/models/legislation/answer.rb b/app/models/legislation/answer.rb index 298fe9f6d..3bf052167 100644 --- a/app/models/legislation/answer.rb +++ b/app/models/legislation/answer.rb @@ -1,4 +1,4 @@ -class Legislation::Answer < ActiveRecord::Base +class Legislation::Answer < ApplicationRecord acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases diff --git a/app/models/legislation/draft_version.rb b/app/models/legislation/draft_version.rb index 99dafac76..57f1039a4 100644 --- a/app/models/legislation/draft_version.rb +++ b/app/models/legislation/draft_version.rb @@ -1,4 +1,4 @@ -class Legislation::DraftVersion < ActiveRecord::Base +class Legislation::DraftVersion < ApplicationRecord VALID_STATUSES = %w(draft published) acts_as_paranoid column: :hidden_at diff --git a/app/models/legislation/process.rb b/app/models/legislation/process.rb index 46d879b63..3d2c72c27 100644 --- a/app/models/legislation/process.rb +++ b/app/models/legislation/process.rb @@ -1,4 +1,4 @@ -class Legislation::Process < ActiveRecord::Base +class Legislation::Process < ApplicationRecord include ActsAsParanoidAliases include Taggable include Milestoneable diff --git a/app/models/legislation/question.rb b/app/models/legislation/question.rb index acee09088..6c60eb9f3 100644 --- a/app/models/legislation/question.rb +++ b/app/models/legislation/question.rb @@ -1,4 +1,4 @@ -class Legislation::Question < ActiveRecord::Base +class Legislation::Question < ApplicationRecord acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases include Notifiable diff --git a/app/models/legislation/question_option.rb b/app/models/legislation/question_option.rb index f69c60894..c6f846120 100644 --- a/app/models/legislation/question_option.rb +++ b/app/models/legislation/question_option.rb @@ -1,4 +1,4 @@ -class Legislation::QuestionOption < ActiveRecord::Base +class Legislation::QuestionOption < ApplicationRecord acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases diff --git a/app/models/poll.rb b/app/models/poll.rb index e90bf191b..22b2d8902 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -1,4 +1,4 @@ -class Poll < ActiveRecord::Base +class Poll < ApplicationRecord include Imageable acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases diff --git a/app/models/poll/answer.rb b/app/models/poll/answer.rb index 8e92988ad..1e602086b 100644 --- a/app/models/poll/answer.rb +++ b/app/models/poll/answer.rb @@ -1,4 +1,4 @@ -class Poll::Answer < ActiveRecord::Base +class Poll::Answer < ApplicationRecord belongs_to :question, -> { with_hidden } belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id" diff --git a/app/models/poll/booth.rb b/app/models/poll/booth.rb index 5dfd32a6f..d10270064 100644 --- a/app/models/poll/booth.rb +++ b/app/models/poll/booth.rb @@ -1,5 +1,5 @@ class Poll - class Booth < ActiveRecord::Base + class Booth < ApplicationRecord has_many :booth_assignments, class_name: "Poll::BoothAssignment" has_many :polls, through: :booth_assignments has_many :shifts diff --git a/app/models/poll/booth_assignment.rb b/app/models/poll/booth_assignment.rb index 811b98923..fa037ed21 100644 --- a/app/models/poll/booth_assignment.rb +++ b/app/models/poll/booth_assignment.rb @@ -1,5 +1,5 @@ class Poll - class BoothAssignment < ActiveRecord::Base + class BoothAssignment < ApplicationRecord belongs_to :booth belongs_to :poll diff --git a/app/models/poll/officer.rb b/app/models/poll/officer.rb index ef96cfa91..c44256a5a 100644 --- a/app/models/poll/officer.rb +++ b/app/models/poll/officer.rb @@ -1,5 +1,5 @@ class Poll - class Officer < ActiveRecord::Base + class Officer < ApplicationRecord belongs_to :user has_many :officer_assignments, class_name: "Poll::OfficerAssignment" has_many :shifts, class_name: "Poll::Shift" diff --git a/app/models/poll/officer_assignment.rb b/app/models/poll/officer_assignment.rb index c997c9a5a..5714d8e74 100644 --- a/app/models/poll/officer_assignment.rb +++ b/app/models/poll/officer_assignment.rb @@ -1,5 +1,5 @@ class Poll - class OfficerAssignment < ActiveRecord::Base + class OfficerAssignment < ApplicationRecord belongs_to :officer belongs_to :booth_assignment has_many :ballot_sheets diff --git a/app/models/poll/partial_result.rb b/app/models/poll/partial_result.rb index b24ae9750..7c4a6657e 100644 --- a/app/models/poll/partial_result.rb +++ b/app/models/poll/partial_result.rb @@ -1,4 +1,4 @@ -class Poll::PartialResult < ActiveRecord::Base +class Poll::PartialResult < ApplicationRecord VALID_ORIGINS = %w{web booth} diff --git a/app/models/poll/question.rb b/app/models/poll/question.rb index 3dc19dabb..16cbe69b7 100644 --- a/app/models/poll/question.rb +++ b/app/models/poll/question.rb @@ -1,4 +1,4 @@ -class Poll::Question < ActiveRecord::Base +class Poll::Question < ApplicationRecord include Measurable include Searchable diff --git a/app/models/poll/recount.rb b/app/models/poll/recount.rb index 878b1ee55..9cd744cc0 100644 --- a/app/models/poll/recount.rb +++ b/app/models/poll/recount.rb @@ -1,4 +1,4 @@ -class Poll::Recount < ActiveRecord::Base +class Poll::Recount < ApplicationRecord VALID_ORIGINS = %w{web booth letter}.freeze diff --git a/app/models/poll/voter.rb b/app/models/poll/voter.rb index 1e4a0d204..522c28de2 100644 --- a/app/models/poll/voter.rb +++ b/app/models/poll/voter.rb @@ -1,5 +1,5 @@ class Poll - class Voter < ActiveRecord::Base + class Voter < ApplicationRecord VALID_ORIGINS = %w{web booth}.freeze diff --git a/app/models/signature.rb b/app/models/signature.rb index 3f5729058..9daf8cbe5 100644 --- a/app/models/signature.rb +++ b/app/models/signature.rb @@ -1,4 +1,4 @@ -class Signature < ActiveRecord::Base +class Signature < ApplicationRecord belongs_to :signature_sheet belongs_to :user diff --git a/app/models/signature_sheet.rb b/app/models/signature_sheet.rb index a8a10a150..86aaf8f3d 100644 --- a/app/models/signature_sheet.rb +++ b/app/models/signature_sheet.rb @@ -1,4 +1,4 @@ -class SignatureSheet < ActiveRecord::Base +class SignatureSheet < ApplicationRecord belongs_to :signable, polymorphic: true belongs_to :author, class_name: "User", foreign_key: "author_id" diff --git a/app/models/site_customization/content_block.rb b/app/models/site_customization/content_block.rb index 6903303e7..2219ef5d4 100644 --- a/app/models/site_customization/content_block.rb +++ b/app/models/site_customization/content_block.rb @@ -1,4 +1,4 @@ -class SiteCustomization::ContentBlock < ActiveRecord::Base +class SiteCustomization::ContentBlock < ApplicationRecord VALID_BLOCKS = %w[top_links footer subnavigation_left subnavigation_right] validates :locale, presence: true, inclusion: { in: I18n.available_locales.map(&:to_s) } diff --git a/app/models/site_customization/image.rb b/app/models/site_customization/image.rb index e933c40a0..12a61dad8 100644 --- a/app/models/site_customization/image.rb +++ b/app/models/site_customization/image.rb @@ -1,4 +1,4 @@ -class SiteCustomization::Image < ActiveRecord::Base +class SiteCustomization::Image < ApplicationRecord VALID_IMAGES = { "logo_header" => [260, 80], "social_media_icon" => [470, 246], diff --git a/app/models/site_customization/page.rb b/app/models/site_customization/page.rb index 6dd8f8d2f..11ced8f07 100644 --- a/app/models/site_customization/page.rb +++ b/app/models/site_customization/page.rb @@ -1,4 +1,4 @@ -class SiteCustomization::Page < ActiveRecord::Base +class SiteCustomization::Page < ApplicationRecord VALID_STATUSES = %w[draft published] has_many :cards, class_name: "Widget::Card", foreign_key: "site_customization_page_id"