models inherits from ApplicationRecord

This commit is contained in:
Juanjo Bazán
2016-09-14 12:31:59 +02:00
committed by Julian Herrero
parent aa3e8c8458
commit b7d9ef6377
27 changed files with 29 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
class Activity < ActiveRecord::Base class Activity < ApplicationRecord
belongs_to :actionable, -> { with_hidden }, polymorphic: true belongs_to :actionable, -> { with_hidden }, polymorphic: true
belongs_to :user, -> { with_hidden } belongs_to :user, -> { with_hidden }

View File

@@ -1,4 +1,4 @@
class Administrator < ActiveRecord::Base class Administrator < ApplicationRecord
belongs_to :user, touch: true belongs_to :user, touch: true
delegate :name, :email, :name_and_email, to: :user delegate :name, :email, :name_and_email, to: :user

View File

@@ -1,5 +1,5 @@
module Ahoy module Ahoy
class Event < ActiveRecord::Base class Event < ApplicationRecord
self.table_name = "ahoy_events" self.table_name = "ahoy_events"
belongs_to :visit belongs_to :visit

View File

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

View File

@@ -1,4 +1,4 @@
class Banner < ActiveRecord::Base class Banner < ApplicationRecord
acts_as_paranoid column: :hidden_at acts_as_paranoid column: :hidden_at
include ActsAsParanoidAliases include ActsAsParanoidAliases

View File

@@ -1,2 +1,2 @@
class Campaign < ActiveRecord::Base class Campaign < ApplicationRecord
end end

View File

@@ -1,4 +1,4 @@
class Comment < ActiveRecord::Base class Comment < ApplicationRecord
include Flaggable include Flaggable
include HasPublicAuthor include HasPublicAuthor
include Graphqlable include Graphqlable

View File

@@ -1,5 +1,5 @@
require "numeric" require "numeric"
class Debate < ActiveRecord::Base class Debate < ApplicationRecord
include Rails.application.routes.url_helpers include Rails.application.routes.url_helpers
include Flaggable include Flaggable
include Taggable include Taggable

View File

@@ -1,4 +1,4 @@
class DirectMessage < ActiveRecord::Base class DirectMessage < ApplicationRecord
belongs_to :sender, class_name: "User", foreign_key: "sender_id" belongs_to :sender, class_name: "User", foreign_key: "sender_id"
belongs_to :receiver, class_name: "User", foreign_key: "receiver_id" belongs_to :receiver, class_name: "User", foreign_key: "receiver_id"

View File

@@ -1,4 +1,4 @@
class FailedCensusCall < ActiveRecord::Base class FailedCensusCall < ApplicationRecord
belongs_to :user, counter_cache: true belongs_to :user, counter_cache: true
belongs_to :poll_officer, class_name: "Poll::Officer", counter_cache: true belongs_to :poll_officer, class_name: "Poll::Officer", counter_cache: true
end end

View File

@@ -1,4 +1,4 @@
class Flag < ActiveRecord::Base class Flag < ApplicationRecord
belongs_to :user belongs_to :user
belongs_to :flaggable, polymorphic: true, counter_cache: true, touch: true belongs_to :flaggable, polymorphic: true, counter_cache: true, touch: true

View File

@@ -1,4 +1,4 @@
class Geozone < ActiveRecord::Base class Geozone < ApplicationRecord
include Graphqlable include Graphqlable

View File

@@ -1,4 +1,4 @@
class Identity < ActiveRecord::Base class Identity < ApplicationRecord
belongs_to :user belongs_to :user
validates :provider, presence: true validates :provider, presence: true

View File

@@ -1,4 +1,4 @@
class Lock < ActiveRecord::Base class Lock < ApplicationRecord
belongs_to :user belongs_to :user
before_save :set_locked_until before_save :set_locked_until

View File

@@ -1,4 +1,4 @@
class Manager < ActiveRecord::Base class Manager < ApplicationRecord
belongs_to :user, touch: true belongs_to :user, touch: true
delegate :name, :email, :name_and_email, to: :user delegate :name, :email, :name_and_email, to: :user

View File

@@ -1,4 +1,4 @@
class Moderator < ActiveRecord::Base class Moderator < ApplicationRecord
belongs_to :user, touch: true belongs_to :user, touch: true
delegate :name, :email, to: :user delegate :name, :email, to: :user

View File

@@ -1,4 +1,4 @@
class Notification < ActiveRecord::Base class Notification < ApplicationRecord
belongs_to :user, counter_cache: true belongs_to :user, counter_cache: true
belongs_to :notifiable, polymorphic: true belongs_to :notifiable, polymorphic: true

View File

@@ -1,4 +1,4 @@
class Organization < ActiveRecord::Base class Organization < ApplicationRecord
include Graphqlable include Graphqlable

View File

@@ -1,4 +1,4 @@
class Proposal < ActiveRecord::Base class Proposal < ApplicationRecord
include Rails.application.routes.url_helpers include Rails.application.routes.url_helpers
include Flaggable include Flaggable
include Taggable include Taggable

View File

@@ -1,4 +1,4 @@
class ProposalNotification < ActiveRecord::Base class ProposalNotification < ApplicationRecord
include Graphqlable include Graphqlable
include Notifiable include Notifiable

View File

@@ -1,4 +1,4 @@
class Setting < ActiveRecord::Base class Setting < ApplicationRecord
validates :key, presence: true, uniqueness: true validates :key, presence: true, uniqueness: true
default_scope { order(id: :asc) } default_scope { order(id: :asc) }

View File

@@ -1,4 +1,4 @@
class SpendingProposal < ActiveRecord::Base class SpendingProposal < ApplicationRecord
include Measurable include Measurable
include Sanitizable include Sanitizable
include Taggable include Taggable

View File

@@ -1,4 +1,4 @@
class User < ActiveRecord::Base class User < ApplicationRecord
include Verification include Verification

View File

@@ -1,4 +1,4 @@
class ValuationAssignment < ActiveRecord::Base class ValuationAssignment < ApplicationRecord
belongs_to :valuator, counter_cache: :spending_proposals_count belongs_to :valuator, counter_cache: :spending_proposals_count
belongs_to :spending_proposal, counter_cache: true belongs_to :spending_proposal, counter_cache: true
end end

View File

@@ -1,4 +1,4 @@
class Valuator < ActiveRecord::Base class Valuator < ApplicationRecord
belongs_to :user, touch: true belongs_to :user, touch: true
belongs_to :valuator_group belongs_to :valuator_group

View File

@@ -1,4 +1,4 @@
class VerifiedUser < ActiveRecord::Base class VerifiedUser < ApplicationRecord
scope :by_user, ->(user) { where(document_number: user.document_number) } scope :by_user, ->(user) { where(document_number: user.document_number) }
scope :by_email, ->(email) { where(email: email) } scope :by_email, ->(email) { where(email: email) }

View File

@@ -1,4 +1,4 @@
class Visit < ActiveRecord::Base class Visit < ApplicationRecord
has_many :ahoy_events, class_name: "Ahoy::Event" has_many :ahoy_events, class_name: "Ahoy::Event"
belongs_to :user belongs_to :user
end end