Add ApplicationRecord

This commit is contained in:
Benjamin Neff 2017-08-05 06:05:22 +02:00
parent fe57bd88e8
commit eb19c327e2
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
56 changed files with 73 additions and 70 deletions

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
class AccountDeletion < ActiveRecord::Base class AccountDeletion < ApplicationRecord
include Diaspora::Federated::Base include Diaspora::Federated::Base
scope :uncompleted, -> { where('completed_at is null') } scope :uncompleted, -> { where('completed_at is null') }

View file

@ -2,7 +2,7 @@
module Api module Api
module OpenidConnect module OpenidConnect
class Authorization < ActiveRecord::Base class Authorization < ApplicationRecord
belongs_to :user belongs_to :user
belongs_to :o_auth_application belongs_to :o_auth_application

View file

@ -23,7 +23,7 @@
module Api module Api
module OpenidConnect module OpenidConnect
class OAuthAccessToken < ActiveRecord::Base class OAuthAccessToken < ApplicationRecord
belongs_to :authorization belongs_to :authorization
before_validation :setup, on: :create before_validation :setup, on: :create

View file

@ -25,7 +25,7 @@ require "digest"
module Api module Api
module OpenidConnect module OpenidConnect
class OAuthApplication < ActiveRecord::Base class OAuthApplication < ApplicationRecord
has_many :authorizations, dependent: :destroy has_many :authorizations, dependent: :destroy
has_many :user, through: :authorizations has_many :user, through: :authorizations

View file

@ -23,7 +23,7 @@
module Api module Api
module OpenidConnect module OpenidConnect
class PairwisePseudonymousIdentifier < ActiveRecord::Base class PairwisePseudonymousIdentifier < ApplicationRecord
self.table_name = "ppid" self.table_name = "ppid"
belongs_to :o_auth_application belongs_to :o_auth_application

View file

@ -0,0 +1,3 @@
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
class Aspect < ActiveRecord::Base class Aspect < ApplicationRecord
belongs_to :user belongs_to :user
has_many :aspect_memberships, :dependent => :destroy has_many :aspect_memberships, :dependent => :destroy

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
class AspectMembership < ActiveRecord::Base class AspectMembership < ApplicationRecord
belongs_to :aspect belongs_to :aspect
belongs_to :contact belongs_to :contact

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
class AspectVisibility < ActiveRecord::Base class AspectVisibility < ApplicationRecord
belongs_to :aspect belongs_to :aspect
validates :aspect, :presence => true validates :aspect, :presence => true

View file

@ -1,4 +1,4 @@
class Block < ActiveRecord::Base class Block < ApplicationRecord
belongs_to :person belongs_to :person
belongs_to :user belongs_to :user

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
class Comment < ActiveRecord::Base class Comment < ApplicationRecord
include Diaspora::Federated::Base include Diaspora::Federated::Base
include Diaspora::Fields::Guid include Diaspora::Fields::Guid

View file

@ -1,4 +1,4 @@
class CommentSignature < ActiveRecord::Base class CommentSignature < ApplicationRecord
include Diaspora::Signature include Diaspora::Signature
self.primary_key = :comment_id self.primary_key = :comment_id

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
class Contact < ActiveRecord::Base class Contact < ApplicationRecord
include Diaspora::Federated::Base include Diaspora::Federated::Base
belongs_to :user belongs_to :user

View file

@ -1,4 +1,4 @@
class Conversation < ActiveRecord::Base class Conversation < ApplicationRecord
include Diaspora::Federated::Base include Diaspora::Federated::Base
include Diaspora::Fields::Guid include Diaspora::Fields::Guid
include Diaspora::Fields::Author include Diaspora::Fields::Author

View file

@ -1,4 +1,4 @@
class ConversationVisibility < ActiveRecord::Base class ConversationVisibility < ApplicationRecord
belongs_to :conversation belongs_to :conversation
belongs_to :person belongs_to :person

View file

@ -1,4 +1,4 @@
class InvitationCode < ActiveRecord::Base class InvitationCode < ApplicationRecord
belongs_to :user belongs_to :user
validates_presence_of :user validates_presence_of :user

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
class Like < ActiveRecord::Base class Like < ApplicationRecord
include Diaspora::Federated::Base include Diaspora::Federated::Base
include Diaspora::Fields::Guid include Diaspora::Fields::Guid
include Diaspora::Fields::Author include Diaspora::Fields::Author

View file

@ -1,4 +1,4 @@
class LikeSignature < ActiveRecord::Base class LikeSignature < ApplicationRecord
include Diaspora::Signature include Diaspora::Signature
self.primary_key = :like_id self.primary_key = :like_id

View file

@ -1,4 +1,4 @@
class Location < ActiveRecord::Base class Location < ApplicationRecord
before_validation :split_coords, on: :create before_validation :split_coords, on: :create
validates_presence_of :lat, :lng validates_presence_of :lat, :lng

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
class Mention < ActiveRecord::Base class Mention < ApplicationRecord
belongs_to :mentions_container, polymorphic: true belongs_to :mentions_container, polymorphic: true
belongs_to :person belongs_to :person
validates :mentions_container, presence: true validates :mentions_container, presence: true

View file

@ -1,4 +1,4 @@
class Message < ActiveRecord::Base class Message < ApplicationRecord
include Diaspora::Federated::Base include Diaspora::Federated::Base
include Diaspora::Fields::Guid include Diaspora::Fields::Guid
include Diaspora::Fields::Author include Diaspora::Fields::Author

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
# #
class Notification < ActiveRecord::Base class Notification < ApplicationRecord
belongs_to :recipient, class_name: "User" belongs_to :recipient, class_name: "User"
has_many :notification_actors, dependent: :destroy has_many :notification_actors, dependent: :destroy
has_many :actors, class_name: "Person", through: :notification_actors, source: :person has_many :actors, class_name: "Person", through: :notification_actors, source: :person

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
class NotificationActor < ActiveRecord::Base class NotificationActor < ApplicationRecord
belongs_to :notification belongs_to :notification
belongs_to :person belongs_to :person

View file

@ -1,4 +1,4 @@
class OEmbedCache < ActiveRecord::Base class OEmbedCache < ApplicationRecord
serialize :data serialize :data
validates :data, :presence => true validates :data, :presence => true

View file

@ -1,4 +1,4 @@
class OpenGraphCache < ActiveRecord::Base class OpenGraphCache < ApplicationRecord
validates :title, :presence => true validates :title, :presence => true
validates :ob_type, :presence => true validates :ob_type, :presence => true
validates :image, :presence => true validates :image, :presence => true

View file

@ -1,4 +1,4 @@
class Participation < ActiveRecord::Base class Participation < ApplicationRecord
include Diaspora::Federated::Base include Diaspora::Federated::Base
include Diaspora::Fields::Guid include Diaspora::Fields::Guid
include Diaspora::Fields::Author include Diaspora::Fields::Author

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
class Person < ActiveRecord::Base class Person < ApplicationRecord
include Diaspora::Fields::Guid include Diaspora::Fields::Guid
# NOTE API V1 to be extracted # NOTE API V1 to be extracted

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
class Photo < ActiveRecord::Base class Photo < ApplicationRecord
include Diaspora::Federated::Base include Diaspora::Federated::Base
include Diaspora::Commentable include Diaspora::Commentable
include Diaspora::Shareable include Diaspora::Shareable

View file

@ -1,4 +1,4 @@
class Pod < ActiveRecord::Base class Pod < ApplicationRecord
enum status: %i( enum status: %i(
unchecked unchecked
no_errors no_errors

View file

@ -1,4 +1,4 @@
class Poll < ActiveRecord::Base class Poll < ApplicationRecord
include Diaspora::Federated::Base include Diaspora::Federated::Base
include Diaspora::Fields::Guid include Diaspora::Fields::Guid

View file

@ -1,4 +1,4 @@
class PollAnswer < ActiveRecord::Base class PollAnswer < ApplicationRecord
include Diaspora::Federated::Base include Diaspora::Federated::Base
include Diaspora::Fields::Guid include Diaspora::Fields::Guid

View file

@ -1,4 +1,4 @@
class PollParticipation < ActiveRecord::Base class PollParticipation < ApplicationRecord
include Diaspora::Federated::Base include Diaspora::Federated::Base
include Diaspora::Fields::Guid include Diaspora::Fields::Guid
include Diaspora::Fields::Author include Diaspora::Fields::Author

View file

@ -1,4 +1,4 @@
class PollParticipationSignature < ActiveRecord::Base class PollParticipationSignature < ApplicationRecord
include Diaspora::Signature include Diaspora::Signature
self.primary_key = :poll_participation_id self.primary_key = :poll_participation_id

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
class Post < ActiveRecord::Base class Post < ApplicationRecord
self.include_root_in_json = false self.include_root_in_json = false
include ApplicationHelper include ApplicationHelper

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
class Profile < ActiveRecord::Base class Profile < ApplicationRecord
self.include_root_in_json = false self.include_root_in_json = false
include Diaspora::Federated::Base include Diaspora::Federated::Base

View file

@ -1,4 +1,4 @@
class Report < ActiveRecord::Base class Report < ApplicationRecord
validates :user_id, presence: true validates :user_id, presence: true
validates :item_id, presence: true validates :item_id, presence: true
validates :item_type, presence: true, inclusion: { validates :item_type, presence: true, inclusion: {

View file

@ -1,6 +1,6 @@
# NOTE add the person object you want to attach role to... # NOTE add the person object you want to attach role to...
class Role < ActiveRecord::Base class Role < ApplicationRecord
belongs_to :person belongs_to :person
validates :person, presence: true validates :person, presence: true

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
class Service < ActiveRecord::Base class Service < ApplicationRecord
attr_accessor :provider, :info, :access_level attr_accessor :provider, :info, :access_level
belongs_to :user belongs_to :user

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
class ShareVisibility < ActiveRecord::Base class ShareVisibility < ApplicationRecord
belongs_to :user belongs_to :user
belongs_to :shareable, polymorphic: :true belongs_to :shareable, polymorphic: :true

View file

@ -1,3 +1,3 @@
class SignatureOrder < ActiveRecord::Base class SignatureOrder < ApplicationRecord
validates :order, presence: true, uniqueness: true validates :order, presence: true, uniqueness: true
end end

View file

@ -1,4 +1,4 @@
class TagFollowing < ActiveRecord::Base class TagFollowing < ApplicationRecord
belongs_to :user belongs_to :user
belongs_to :tag, :class_name => "ActsAsTaggableOn::Tag" belongs_to :tag, :class_name => "ActsAsTaggableOn::Tag"

View file

@ -2,7 +2,7 @@
# licensed under the Affero General Public License version 3 or later. See # licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file. # the COPYRIGHT file.
class User < ActiveRecord::Base class User < ApplicationRecord
include AuthenticationToken include AuthenticationToken
include Connecting include Connecting
include Querying include Querying

View file

@ -1,4 +1,4 @@
class UserPreference < ActiveRecord::Base class UserPreference < ApplicationRecord
belongs_to :user belongs_to :user
validate :must_be_valid_email_type validate :must_be_valid_email_type

View file

@ -1,5 +1,5 @@
class MigrateActivityStreamToStatusMessage < ActiveRecord::Migration class MigrateActivityStreamToStatusMessage < ActiveRecord::Migration
class Post < ActiveRecord::Base; self.inheritance_column = false; end class Post < ApplicationRecord; self.inheritance_column = false; end
def up def up
posts_stream_photos = Post.where(type: 'ActivityStreams::Photo') posts_stream_photos = Post.where(type: 'ActivityStreams::Photo')
posts_stream_photos.each do |p| posts_stream_photos.each do |p|

View file

@ -1,5 +1,5 @@
class ExtendPods < ActiveRecord::Migration class ExtendPods < ActiveRecord::Migration
class Pod < ActiveRecord::Base class Pod < ApplicationRecord
has_many :people has_many :people
DEFAULT_PORTS = [URI::HTTP::DEFAULT_PORT, URI::HTTPS::DEFAULT_PORT] DEFAULT_PORTS = [URI::HTTP::DEFAULT_PORT, URI::HTTPS::DEFAULT_PORT]
@ -18,7 +18,7 @@ class ExtendPods < ActiveRecord::Migration
end end
end end
class Person < ActiveRecord::Base class Person < ApplicationRecord
belongs_to :owner, class_name: "User" belongs_to :owner, class_name: "User"
belongs_to :pod belongs_to :pod
@ -27,7 +27,7 @@ class ExtendPods < ActiveRecord::Migration
end end
end end
class User < ActiveRecord::Base class User < ApplicationRecord
has_one :person, inverse_of: :owner, foreign_key: :owner_id has_one :person, inverse_of: :owner, foreign_key: :owner_id
end end

View file

@ -1,5 +1,5 @@
class LinkShareVisibilitiesWithUser < ActiveRecord::Migration class LinkShareVisibilitiesWithUser < ActiveRecord::Migration
class ShareVisibility < ActiveRecord::Base class ShareVisibility < ApplicationRecord
end end
def up def up

View file

@ -1,5 +1,5 @@
class CleanupAspectVisibility < ActiveRecord::Migration class CleanupAspectVisibility < ActiveRecord::Migration
class AspectVisibility < ActiveRecord::Base class AspectVisibility < ApplicationRecord
end end
def up def up

View file

@ -1,5 +1,5 @@
class CleanupParticipations < ActiveRecord::Migration class CleanupParticipations < ActiveRecord::Migration
class Participation < ActiveRecord::Base class Participation < ApplicationRecord
end end
def up def up

View file

@ -1,5 +1,5 @@
class CreateSignatureTables < ActiveRecord::Migration class CreateSignatureTables < ActiveRecord::Migration
class SignatureOrder < ActiveRecord::Base class SignatureOrder < ApplicationRecord
end end
RELAYABLES = %i(comment like poll_participation).freeze RELAYABLES = %i(comment like poll_participation).freeze

View file

@ -1,18 +1,18 @@
class ParticipationCounter < ActiveRecord::Migration class ParticipationCounter < ActiveRecord::Migration
class Comment < ActiveRecord::Base class Comment < ApplicationRecord
end end
class Like < ActiveRecord::Base class Like < ApplicationRecord
end end
class Participation < ActiveRecord::Base class Participation < ApplicationRecord
belongs_to :author, class_name: "Person" belongs_to :author, class_name: "Person"
end end
class Poll < ActiveRecord::Base class Poll < ApplicationRecord
end end
class PollParticipation < ActiveRecord::Base class PollParticipation < ApplicationRecord
belongs_to :poll belongs_to :poll
end end

View file

@ -1,8 +1,8 @@
class CleanupInvitationColumnsFromUsers < ActiveRecord::Migration class CleanupInvitationColumnsFromUsers < ActiveRecord::Migration
class InvitationCode < ActiveRecord::Base class InvitationCode < ApplicationRecord
end end
class User < ActiveRecord::Base class User < ApplicationRecord
end end
def change def change

View file

@ -1,5 +1,5 @@
class RemoveStartedSharingNotificationsWithoutContact < ActiveRecord::Migration class RemoveStartedSharingNotificationsWithoutContact < ActiveRecord::Migration
class Notification < ActiveRecord::Base class Notification < ApplicationRecord
end end
def up def up

View file

@ -1,5 +1,5 @@
class RemoveInvalidUnconfirmedEmails < ActiveRecord::Migration class RemoveInvalidUnconfirmedEmails < ActiveRecord::Migration
class User < ActiveRecord::Base class User < ApplicationRecord
end end
def up def up

View file

@ -1,8 +1,8 @@
class FixPhotosShareVisibilities < ActiveRecord::Migration class FixPhotosShareVisibilities < ActiveRecord::Migration
class Photo < ActiveRecord::Base class Photo < ApplicationRecord
end end
class ShareVisibility < ActiveRecord::Base class ShareVisibility < ApplicationRecord
end end
def up def up

View file

@ -17,10 +17,10 @@ class PolymorphicMentions < ActiveRecord::Migration
reversible(&method(:up_down)) reversible(&method(:up_down))
end end
class Mention < ActiveRecord::Base class Mention < ApplicationRecord
end end
class Notification < ActiveRecord::Base class Notification < ApplicationRecord
end end
def up_down(change) def up_down(change)

View file

@ -1,24 +1,24 @@
#we dont have the environment, and it is not carring over from the migration #we dont have the environment, and it is not carring over from the migration
unless defined?(Person) unless defined?(Person)
class Person < ActiveRecord::Base class Person < ApplicationRecord
belongs_to :owner, :class_name => 'User' belongs_to :owner, :class_name => 'User'
end end
end end
unless defined?(User) unless defined?(User)
class User < ActiveRecord::Base class User < ApplicationRecord
serialize :hidden_shareables, Hash serialize :hidden_shareables, Hash
end end
end end
unless defined?(Contact) unless defined?(Contact)
class Contact < ActiveRecord::Base class Contact < ApplicationRecord
belongs_to :user belongs_to :user
end end
end end
unless defined?(ShareVisibility) unless defined?(ShareVisibility)
class ShareVisibility < ActiveRecord::Base class ShareVisibility < ApplicationRecord
belongs_to :contact belongs_to :contact
end end
end end