Commit bd88e2db authored by dgt's avatar dgt Committed by azul

Models inherit from ApplicationRecord

parent f0bd3b4d
AllCops:
TargetRailsVersion: 5.1
TargetRubyVersion: 2.3
Exclude:
- 'bin/*'
DisplayCopNames: true
......@@ -17,3 +19,8 @@ Metrics/LineLength:
- 'config/deploy.rb'
- 'config/permissions.rb'
- 'lib/**/*'
- 'home/dora/Dev/crabgrass-media/'
- 'home/dora/Dev/2018'
Style/FrozenStringLiteralComment:
AutoCorrect: false
......@@ -71,7 +71,7 @@
# add_index "assets", ["page_terms_id"], :name => "pterms"
#
class Asset < ActiveRecord::Base
class Asset < ApplicationRecord
include Crabgrass::Page::Data
# fields in assets table not in asset_versions
......
class Asset::Version < ActiveRecord::Base
class Asset::Version < ApplicationRecord
delegate :page, :public?, :has_access!, to: :asset
def self.policy_class
......
......@@ -16,7 +16,7 @@
require 'open-uri'
class Avatar < ActiveRecord::Base
class Avatar < ApplicationRecord
# This is only used in singular resources and avatar_path.
# So we use this workaround for form_for paths:
# https://github.com/rails/rails/issues/1769#issuecomment-41025758
......
class CspReport < ActiveRecord::Base
class CspReport < ApplicationRecord
end
......@@ -11,7 +11,7 @@
# add_index "discussions", ["page_id"], :name => "index_discussions_page_id"
#
class Discussion < ActiveRecord::Base
class Discussion < ApplicationRecord
##
## ASSOCIATIONS
##
......
......@@ -5,5 +5,5 @@
# are still around.
#
class ExternalVideo < ActiveRecord::Base
class ExternalVideo < ApplicationRecord
end
......@@ -22,7 +22,7 @@
# group.council => nil or group
# group.users => users
class Group < ActiveRecord::Base
class Group < ApplicationRecord
extend RouteInheritance # subclasses use /groups routes
# core group extentions
......
......@@ -17,7 +17,7 @@
# t.integer "delegation_id", :limit => 11
# end
#
class Group::Federating < ActiveRecord::Base
class Group::Federating < ApplicationRecord
self.table_name = 'federatings'
# required
......
......@@ -15,7 +15,7 @@
# add_index "memberships", ["user_id", "group_id"], :name => "ug"
#
class Group::Membership < ActiveRecord::Base
class Group::Membership < ApplicationRecord
self.table_name = 'memberships'
belongs_to :user
......
......@@ -13,7 +13,7 @@
#
# add_index "group_participations", ["group_id", "page_id"], :name => "index_group_participations"
class Group::Participation < ActiveRecord::Base
class Group::Participation < ApplicationRecord
include Page::ParticipationAccess
belongs_to :page, inverse_of: :group_participations
......
class Notice < ActiveRecord::Base
class Notice < ApplicationRecord
belongs_to :user
belongs_to :noticable, polymorphic: true
belongs_to :avatar
......
......@@ -60,7 +60,7 @@ require 'English'
#
# Yeah, so, there are way too many indices on the pages table.
class Page < ActiveRecord::Base
class Page < ApplicationRecord
extend RouteInheritance # subclasses use /pages routes
include Page::Users # page <> users relationship
......
......@@ -18,7 +18,7 @@
require 'password'
class Page::AccessCode < ActiveRecord::Base
class Page::AccessCode < ApplicationRecord
self.table_name = 'page_access_codes'
belongs_to :user
......
class Page::History < ActiveRecord::Base
class Page::History < ApplicationRecord
belongs_to :user
belongs_to :page
belongs_to :item, polymorphic: true
......
......@@ -37,7 +37,7 @@
# in a normal page query.
#
class Page::Terms < ActiveRecord::Base
class Page::Terms < ApplicationRecord
include ThinkingSphinx::Scopes
FIELD_WEIGHTS = {
......
......@@ -6,7 +6,7 @@
#
#
class PgpKey < ActiveRecord::Base
class PgpKey < ApplicationRecord
belongs_to :user
before_validation :update_key
......
......@@ -51,7 +51,7 @@ require 'pathname' # required for relative paths
MAX_HEIGHT = 1024
MAX_WIDTH = 1024
class Picture < ActiveRecord::Base
class Picture < ApplicationRecord
serialize :dimensions # Hash
serialize :average_color # Array
after_destroy :destroy_files
......
......@@ -2,7 +2,7 @@
# the user makes makes a vote for each possibility
# a vote can be a ranking (1st to 6th for a choice of 6 possibilities) for one of several possibilities
# or a vote can be a rating (0 to 5 for example) for every possibility
class Poll < ActiveRecord::Base
class Poll < ApplicationRecord
has_many :pages, as: :data
def page
pages.first
......
class Poll::Possible < ActiveRecord::Base
class Poll::Possible < ApplicationRecord
self.table_name = 'possibles'
model_name.instance_variable_set(:@i18n_key, 'possible')
def to_partial_path
......
class Poll::Vote < ActiveRecord::Base
class Poll::Vote < ApplicationRecord
self.table_name = 'votes'
validates_presence_of :votable_id
......
......@@ -9,7 +9,7 @@
# t.string "type"
# end
class Post < ActiveRecord::Base
class Post < ApplicationRecord
##
## ASSOCIATIONS
##
......
......@@ -40,7 +40,7 @@
# Currently unused: language.
#
class Profile < ActiveRecord::Base
class Profile < ApplicationRecord
belongs_to :language
##
......
#
class ProfileWebsite < ActiveRecord::Base
class ProfileWebsite < ApplicationRecord
self.table_name = 'websites'
validates_presence_of :site_title
......
......@@ -2,7 +2,7 @@
# Adapted from acts_as_rateable
#
class Rating < ActiveRecord::Base
class Rating < ApplicationRecord
belongs_to :rateable, polymorphic: true
belongs_to :user
......
......@@ -27,7 +27,7 @@
# Anytime an action needs approval, a Request is made.
# This includes invitations, requests to join, RSVP, etc.
#
class Request < ActiveRecord::Base
class Request < ApplicationRecord
include AASM
##
......
class Star < ActiveRecord::Base
class Star < ApplicationRecord
belongs_to :user, inverse_of: :stars
belongs_to :starred, polymorphic: true, counter_cache: true
......
class Task < ActiveRecord::Base
class Task < ApplicationRecord
belongs_to :page
# has_and_belongs_to_many :users, :foreign_key => 'task_id'
has_many :participations,
......
class Task::Participation < ActiveRecord::Base
class Task::Participation < ApplicationRecord
self.table_name = 'task_participations'
belongs_to :user
belongs_to :task
......
......@@ -12,7 +12,7 @@
# t.boolean "failure"
# end
#
class Thumbnail < ActiveRecord::Base
class Thumbnail < ApplicationRecord
#
# Our parent could be the main asset, or it could be a *version* of the
# asset.
......
class User < ActiveRecord::Base
class User < ApplicationRecord
##
## CORE EXTENSIONS
......
......@@ -13,7 +13,7 @@
# attend, :boolean -- the user will attend event
#
class User::Participation < ActiveRecord::Base
class User::Participation < ApplicationRecord
include Page::ParticipationAccess
belongs_to :page, inverse_of: :user_participations
......
# user to user relationship
class User::Relationship < ActiveRecord::Base
class User::Relationship < ApplicationRecord
self.table_name = :relationships
belongs_to :user
......
class User::Token < ActiveRecord::Base
class User::Token < ApplicationRecord
self.table_name = 'tokens'
belongs_to :user
......
......@@ -22,7 +22,7 @@
# 2. updating body automatically updates html and structure
# 3. wiki should never get saved with body/body products mismatch
# 4. loaded wiki should see only the latest body products, if body was updated from outside
class Wiki < ActiveRecord::Base
class Wiki < ApplicationRecord
include Wiki::Locking
include Wiki::Sections
include Wiki::Versioning
......
......@@ -8,7 +8,7 @@
# a subsection of :document will appear open to a different user
# Always use Wiki::Locking methods for manipulating wiki locks
# since those methods take section hierarchy into account
class Wiki::Lock < ActiveRecord::Base
class Wiki::Lock < ApplicationRecord
belongs_to :wiki
validates_presence_of :wiki
......
class Wiki::Version < ActiveRecord::Base
class Wiki::Version < ApplicationRecord
before_destroy :confirm_existance_of_other_version
def self.most_recent
......
class TasksUser < ActiveRecord::Base
class TasksUser < ApplicationRecord
belongs_to :user
end
......
......@@ -2,7 +2,7 @@
# the join table for assets that are in photo galleries.
#
class Showing < ActiveRecord::Base
class Showing < ApplicationRecord
belongs_to :gallery
belongs_to :asset
......
......@@ -5,7 +5,7 @@
# t.string "settings"
# end
#
class Survey < ActiveRecord::Base
class Survey < ApplicationRecord
serialize :settings
serialize_default :settings, edit_may_create: true, edit_may_see_responses: true
......
......@@ -8,7 +8,7 @@
# t.integer "external_video_id", :limit => 11
# end
class SurveyAnswer < ActiveRecord::Base
class SurveyAnswer < ApplicationRecord
CHOICE_FOR_UNCHECKED = '__UNCHECKED'.freeze
belongs_to :question, class_name: 'SurveyQuestion'
......
......@@ -14,7 +14,7 @@
# t.boolean "private", :default => false
# end
class SurveyQuestion < ActiveRecord::Base
class SurveyQuestion < ApplicationRecord
belongs_to :survey
serialize :choices, Array
serialize_default :choices, []
......
......@@ -8,7 +8,7 @@
# t.datetime "created_at"
# end
class SurveyResponse < ActiveRecord::Base
class SurveyResponse < ApplicationRecord
include ActionView::Helpers::TextHelper # to truncate
belongs_to :user
......
......@@ -205,7 +205,7 @@ module ActiveRecord #:nodoc:
#
# Create the dynamic versioned model
#
const_set(versioned_class_name, Class.new(ActiveRecord::Base)).class_eval do
const_set(versioned_class_name, Class.new(ApplicationRecord)).class_eval do
def self.reloadable?
false
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment