mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
inherit models from ApplicationRecord
This commit is contained in:
parent
c25ff0d1ab
commit
6b66d601e1
@ -2,7 +2,7 @@
|
||||
|
||||
# Abuse is a report made by a visitor (not especially a logged user) who has signaled a content that seems abusive to his eyes.
|
||||
# It is currently used with projects.
|
||||
class Abuse < ActiveRecord::Base
|
||||
class Abuse < ApplicationRecord
|
||||
include NotifyWith::NotificationAttachedObject
|
||||
|
||||
belongs_to :signaled, polymorphic: true
|
||||
|
@ -6,7 +6,7 @@ require 'zip'
|
||||
|
||||
# AccountingPeriod is a period of N days (N > 0) which as been closed by an admin
|
||||
# to prevent writing new accounting lines (invoices & refunds) during this period of time.
|
||||
class AccountingPeriod < ActiveRecord::Base
|
||||
class AccountingPeriod < ApplicationRecord
|
||||
before_destroy { false }
|
||||
before_update { false }
|
||||
before_create :compute_totals
|
||||
|
@ -1,3 +1,3 @@
|
||||
class Address < ActiveRecord::Base
|
||||
class Address < ApplicationRecord
|
||||
belongs_to :placeable, polymorphic: true
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
class AgeRange < ActiveRecord::Base
|
||||
class AgeRange < ApplicationRecord
|
||||
extend FriendlyId
|
||||
friendly_id :name, use: :slugged
|
||||
|
||||
|
7
app/models/application_record.rb
Normal file
7
app/models/application_record.rb
Normal file
@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# SuperClass for all app models.
|
||||
# This is a single spot to configure app-wide model behavior.
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
end
|
@ -3,6 +3,6 @@
|
||||
require 'file_size_validator'
|
||||
|
||||
# Generic class, parent of uploadable items
|
||||
class Asset < ActiveRecord::Base
|
||||
class Asset < ApplicationRecord
|
||||
belongs_to :viewable, polymorphic: true
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AuthProvider < ActiveRecord::Base
|
||||
class AuthProvider < ApplicationRecord
|
||||
# this is a simple stub used for database creation & configuration
|
||||
class SimpleAuthProvider < Object
|
||||
def providable_type
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Availability stores time slots that are available to reservation for an associated reservable
|
||||
# Eg. a 3D printer will be reservable on thursday from 9 to 11 pm
|
||||
# Availabilities may be subdivided into Slots (of 1h), for some types of reservables (eg. Machine)
|
||||
class Availability < ActiveRecord::Base
|
||||
class Availability < ApplicationRecord
|
||||
# elastic initialisations
|
||||
include Elasticsearch::Model
|
||||
index_name 'fablab'
|
||||
|
@ -1,4 +1,4 @@
|
||||
class AvailabilityTag < ActiveRecord::Base
|
||||
class AvailabilityTag < ApplicationRecord
|
||||
belongs_to :availability
|
||||
belongs_to :tag
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
class Category < ActiveRecord::Base
|
||||
class Category < ApplicationRecord
|
||||
extend FriendlyId
|
||||
friendly_id :name, use: :slugged
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
class Component < ActiveRecord::Base
|
||||
class Component < ApplicationRecord
|
||||
has_and_belongs_to_many :projects, join_table: 'projects_components'
|
||||
validates :name, presence: true, length: { maximum: 50 }
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Coupon is a textual code associated with a discount rate or an amount of discount
|
||||
class Coupon < ActiveRecord::Base
|
||||
class Coupon < ApplicationRecord
|
||||
has_many :invoices
|
||||
|
||||
after_commit :create_stripe_coupon, on: [:create]
|
||||
|
@ -1,4 +1,4 @@
|
||||
class Credit < ActiveRecord::Base
|
||||
class Credit < ApplicationRecord
|
||||
belongs_to :creditable, polymorphic: true
|
||||
belongs_to :plan
|
||||
has_many :users_credits, dependent: :destroy
|
||||
|
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Admin defined assets (like PDF or images uploaded)
|
||||
class CustomAsset < ActiveRecord::Base
|
||||
class CustomAsset < ApplicationRecord
|
||||
has_one :custom_asset_file, as: :viewable, dependent: :destroy
|
||||
accepts_nested_attributes_for :custom_asset_file, allow_destroy: true
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
class DatabaseProvider < ActiveRecord::Base
|
||||
class DatabaseProvider < ApplicationRecord
|
||||
has_one :auth_provider, as: :providable, dependent: :destroy
|
||||
|
||||
def protected_fields
|
||||
|
@ -1,4 +1,4 @@
|
||||
class Event < ActiveRecord::Base
|
||||
class Event < ApplicationRecord
|
||||
include NotifyWith::NotificationAttachedObject
|
||||
include ApplicationHelper
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
class EventPriceCategory < ActiveRecord::Base
|
||||
class EventPriceCategory < ApplicationRecord
|
||||
belongs_to :event
|
||||
belongs_to :price_category
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
class EventTheme < ActiveRecord::Base
|
||||
class EventTheme < ApplicationRecord
|
||||
extend FriendlyId
|
||||
friendly_id :name, use: :slugged
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Export is a reference to a file asynchronously generated by the system and downloadable by the user
|
||||
class Export < ActiveRecord::Base
|
||||
class Export < ApplicationRecord
|
||||
require 'fileutils'
|
||||
|
||||
belongs_to :user
|
||||
|
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Group is way to bind users with prices. Different prices can be defined for each plan/reservable, for each group
|
||||
class Group < ActiveRecord::Base
|
||||
class Group < ApplicationRecord
|
||||
has_many :plans
|
||||
has_many :users
|
||||
has_many :statistic_profiles
|
||||
|
@ -3,7 +3,7 @@
|
||||
require 'checksum'
|
||||
|
||||
# Setting values, kept history of modifications
|
||||
class HistoryValue < ActiveRecord::Base
|
||||
class HistoryValue < ApplicationRecord
|
||||
belongs_to :setting
|
||||
belongs_to :invoicing_profile
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# iCalendar (RFC 5545) files, stored by URL and kept with their display configuration
|
||||
class ICalendar < ActiveRecord::Base
|
||||
class ICalendar < ApplicationRecord
|
||||
has_many :i_calendar_events, dependent: :destroy
|
||||
|
||||
after_create :sync_events
|
||||
|
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# iCalendar (RFC 5545) event, belonging to an ICalendar object (its source)
|
||||
class ICalendarEvent < ActiveRecord::Base
|
||||
class ICalendarEvent < ApplicationRecord
|
||||
belongs_to :i_calendar
|
||||
|
||||
def self.update_or_create_by(args, attributes)
|
||||
|
@ -4,7 +4,7 @@ require 'file_size_validator'
|
||||
|
||||
# An Import is a file uploaded by an user that provides some data to the database.
|
||||
# Currently, this is used to import some users from a CSV file
|
||||
class Import < ActiveRecord::Base
|
||||
class Import < ApplicationRecord
|
||||
mount_uploader :attachment, ImportUploader
|
||||
|
||||
belongs_to :user
|
||||
|
@ -4,7 +4,7 @@ require 'checksum'
|
||||
|
||||
# Invoice correspond to a single purchase made by an user. This purchase may
|
||||
# include reservation(s) and/or a subscription
|
||||
class Invoice < ActiveRecord::Base
|
||||
class Invoice < ApplicationRecord
|
||||
include NotifyWith::NotificationAttachedObject
|
||||
require 'fileutils'
|
||||
scope :only_invoice, -> { where(type: nil) }
|
||||
|
@ -3,7 +3,7 @@
|
||||
require 'checksum'
|
||||
|
||||
# A single line inside an invoice. Can be a subscription or a reservation
|
||||
class InvoiceItem < ActiveRecord::Base
|
||||
class InvoiceItem < ApplicationRecord
|
||||
belongs_to :invoice
|
||||
belongs_to :subscription
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
# This table will save the user's profile data needed for legal accounting (invoices, wallet, etc.)
|
||||
# Legal accounting must be kept for 10 years but GDPR requires that an user can delete his account at any time.
|
||||
# The data will be kept even if the user is deleted, but it will be unlinked from the user's account.
|
||||
class InvoicingProfile < ActiveRecord::Base
|
||||
class InvoicingProfile < ApplicationRecord
|
||||
belongs_to :user
|
||||
has_one :address, as: :placeable, dependent: :destroy
|
||||
accepts_nested_attributes_for :address, allow_destroy: true
|
||||
|
@ -1,4 +1,4 @@
|
||||
class Licence < ActiveRecord::Base
|
||||
class Licence < ApplicationRecord
|
||||
|
||||
has_many :projects
|
||||
validates :name, presence: true, length: { maximum: 160 }
|
||||
|
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Machine is an hardware equipment hosted in the fablab that is available for reservation to the members
|
||||
class Machine < ActiveRecord::Base
|
||||
class Machine < ApplicationRecord
|
||||
extend FriendlyId
|
||||
friendly_id :name, use: :slugged
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
class MachinesAvailability < ActiveRecord::Base
|
||||
class MachinesAvailability < ApplicationRecord
|
||||
belongs_to :machine
|
||||
belongs_to :availability
|
||||
after_destroy :cleanup_availability
|
||||
|
@ -1,4 +1,4 @@
|
||||
class Notification < ActiveRecord::Base
|
||||
class Notification < ApplicationRecord
|
||||
include NotifyWith::Notification
|
||||
|
||||
def get_meta_data(key)
|
||||
|
@ -1,3 +1,3 @@
|
||||
class OAuth2Mapping < ActiveRecord::Base
|
||||
class OAuth2Mapping < ApplicationRecord
|
||||
belongs_to :o_auth2_provider
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
class OAuth2Provider < ActiveRecord::Base
|
||||
class OAuth2Provider < ApplicationRecord
|
||||
has_one :auth_provider, as: :providable
|
||||
has_many :o_auth2_mappings, dependent: :destroy
|
||||
accepts_nested_attributes_for :o_auth2_mappings, allow_destroy: true
|
||||
|
@ -1,4 +1,4 @@
|
||||
class OfferDay < ActiveRecord::Base
|
||||
class OfferDay < ApplicationRecord
|
||||
include NotifyWith::NotificationAttachedObject
|
||||
|
||||
has_many :invoices, as: :invoiced, dependent: :destroy
|
||||
|
@ -1,4 +1,4 @@
|
||||
class OpenAPI::CallsCountTracing < ActiveRecord::Base
|
||||
class OpenAPI::CallsCountTracing < ApplicationRecord
|
||||
belongs_to :client, foreign_key: :open_api_client_id
|
||||
validates :client, :at, presence: true
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
class OpenAPI::Client < ActiveRecord::Base
|
||||
class OpenAPI::Client < ApplicationRecord
|
||||
has_many :calls_count_tracings, foreign_key: :open_api_client_id, dependent: :destroy
|
||||
has_secure_token
|
||||
validates :name, presence: true
|
||||
|
@ -1,4 +1,4 @@
|
||||
class Organization < ActiveRecord::Base
|
||||
class Organization < ApplicationRecord
|
||||
belongs_to :profile
|
||||
belongs_to :invoicing_profile
|
||||
has_one :address, as: :placeable, dependent: :destroy
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Plan is a generic description of a subscription plan, which can be subscribed by a member to benefit from advantageous prices.
|
||||
# Subscribers can also get some Credits for some reservable items
|
||||
class Plan < ActiveRecord::Base
|
||||
class Plan < ApplicationRecord
|
||||
belongs_to :group
|
||||
|
||||
has_many :credits, dependent: :destroy
|
||||
|
@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class PlansAvailability < ActiveRecord::Base
|
||||
class PlansAvailability < ApplicationRecord
|
||||
belongs_to :plan
|
||||
belongs_to :availability
|
||||
end
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Store customized price for various items (Machine, Space), depending on the group and on the plan
|
||||
# Also provides a static helper method to compute the price details of a shopping cart
|
||||
class Price < ActiveRecord::Base
|
||||
class Price < ApplicationRecord
|
||||
belongs_to :group
|
||||
belongs_to :plan
|
||||
belongs_to :priceable, polymorphic: true
|
||||
|
@ -1,4 +1,4 @@
|
||||
class PriceCategory < ActiveRecord::Base
|
||||
class PriceCategory < ApplicationRecord
|
||||
has_many :event_price_category
|
||||
has_many :events, through: :event_price_categories
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Personal data attached to an user (like first_name, date of birth, etc.)
|
||||
class Profile < ActiveRecord::Base
|
||||
class Profile < ApplicationRecord
|
||||
belongs_to :user
|
||||
has_one :user_avatar, as: :viewable, dependent: :destroy
|
||||
accepts_nested_attributes_for :user_avatar,
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Project is the documentation about an object built by a fab-user
|
||||
# It can describe the steps taken by the fab-user to build his object, provide photos, description, attached CAO files, etc.
|
||||
class Project < ActiveRecord::Base
|
||||
class Project < ApplicationRecord
|
||||
include AASM
|
||||
include NotifyWith::NotificationAttachedObject
|
||||
include OpenlabSync
|
||||
|
@ -1,4 +1,4 @@
|
||||
class ProjectStep < ActiveRecord::Base
|
||||
class ProjectStep < ApplicationRecord
|
||||
belongs_to :project
|
||||
has_many :project_step_images, as: :viewable, dependent: :destroy
|
||||
accepts_nested_attributes_for :project_step_images, allow_destroy: true, reject_if: :all_blank
|
||||
|
@ -1,4 +1,4 @@
|
||||
class ProjectUser < ActiveRecord::Base
|
||||
class ProjectUser < ApplicationRecord
|
||||
include NotifyWith::NotificationAttachedObject
|
||||
|
||||
belongs_to :project
|
||||
|
@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Reservation < ActiveRecord::Base
|
||||
class Reservation < ApplicationRecord
|
||||
include NotifyWith::NotificationAttachedObject
|
||||
|
||||
belongs_to :statistic_profile
|
||||
|
@ -1,4 +1,4 @@
|
||||
class Role < ActiveRecord::Base
|
||||
class Role < ApplicationRecord
|
||||
has_and_belongs_to_many :users, join_table: 'users_roles'
|
||||
belongs_to :resource, polymorphic: true
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
# For some settings, changing them will involve some callback actions (like rebuilding the stylesheets if the theme color Setting is changed).
|
||||
# A full history of the previous values is kept in database with the date and the author of the change
|
||||
# after_update callback is handled by SettingService
|
||||
class Setting < ActiveRecord::Base
|
||||
class Setting < ApplicationRecord
|
||||
has_many :history_values
|
||||
validates :name, inclusion:
|
||||
{ in: %w[about_title
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Time range of duration defined by ApplicationHelper::SLOT_DURATION, slicing an Availability.
|
||||
# During a slot a Reservation is possible
|
||||
# Only reserved slots are persisted in DB, others are instanciated on the fly
|
||||
class Slot < ActiveRecord::Base
|
||||
class Slot < ApplicationRecord
|
||||
include NotifyWith::NotificationAttachedObject
|
||||
|
||||
has_many :slots_reservations, dependent: :destroy
|
||||
|
@ -1,4 +1,4 @@
|
||||
class SlotsReservation < ActiveRecord::Base
|
||||
class SlotsReservation < ApplicationRecord
|
||||
belongs_to :slot
|
||||
belongs_to :reservation
|
||||
after_destroy :cleanup_slots
|
||||
|
@ -1,4 +1,4 @@
|
||||
class Space < ActiveRecord::Base
|
||||
class Space < ApplicationRecord
|
||||
extend FriendlyId
|
||||
friendly_id :name, use: :slugged
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
class SpacesAvailability < ActiveRecord::Base
|
||||
class SpacesAvailability < ApplicationRecord
|
||||
belongs_to :space
|
||||
belongs_to :availability
|
||||
after_destroy :cleanup_availability
|
||||
|
@ -1,3 +1,3 @@
|
||||
class StatisticCustomAggregation < ActiveRecord::Base
|
||||
class StatisticCustomAggregation < ApplicationRecord
|
||||
belongs_to :statistic_type
|
||||
end
|
||||
|
@ -1,3 +1,3 @@
|
||||
class StatisticField < ActiveRecord::Base
|
||||
class StatisticField < ApplicationRecord
|
||||
has_one :statistic_index
|
||||
end
|
||||
|
@ -1,3 +1,3 @@
|
||||
class StatisticGraph < ActiveRecord::Base
|
||||
class StatisticGraph < ApplicationRecord
|
||||
belongs_to :statistic_index
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
class StatisticIndex < ActiveRecord::Base
|
||||
class StatisticIndex < ApplicationRecord
|
||||
has_many :statistic_types
|
||||
has_many :statistic_fields
|
||||
has_one :statistic_graph
|
||||
|
@ -6,7 +6,7 @@ AVG_DAYS_PER_YEAR = 365.2425
|
||||
# GDPR requires that an user can delete his account at any time but we need to keep the statistics original data to being able to
|
||||
# rebuild them at any time.
|
||||
# The data will be kept even if the user is deleted, but it will be unlinked from the user's account (ie. anonymized)
|
||||
class StatisticProfile < ActiveRecord::Base
|
||||
class StatisticProfile < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :group
|
||||
belongs_to :role
|
||||
|
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Stores trainings validated per user (non validated trainings are only recorded in reservations)
|
||||
class StatisticProfileTraining < ActiveRecord::Base
|
||||
class StatisticProfileTraining < ApplicationRecord
|
||||
include NotifyWith::NotificationAttachedObject
|
||||
|
||||
belongs_to :statistic_profile
|
||||
|
@ -1,4 +1,4 @@
|
||||
class StatisticSubType < ActiveRecord::Base
|
||||
class StatisticSubType < ApplicationRecord
|
||||
has_many :statistic_type_sub_types, dependent: :destroy
|
||||
has_many :statistic_types, through: :statistic_type_sub_types
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
class StatisticType < ActiveRecord::Base
|
||||
class StatisticType < ApplicationRecord
|
||||
has_one :statistic_index
|
||||
has_many :statistic_type_sub_types
|
||||
has_many :statistic_sub_types, through: :statistic_type_sub_types
|
||||
|
@ -1,4 +1,4 @@
|
||||
class StatisticTypeSubType < ActiveRecord::Base
|
||||
class StatisticTypeSubType < ApplicationRecord
|
||||
belongs_to :statistic_type
|
||||
belongs_to :statistic_sub_type
|
||||
end
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Stylesheet is a cached CSS file that allows to easily customize the interface of Fab-manager with some configurable colors and
|
||||
# a picture for the background of the user's profile.
|
||||
# There's only one stylesheet record in the database, which is updated on each colour change.
|
||||
class Stylesheet < ActiveRecord::Base
|
||||
class Stylesheet < ApplicationRecord
|
||||
validates_presence_of :contents
|
||||
|
||||
## ===== THEME =====
|
||||
|
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Subscription is an active or archived subscription of an User to a Plan
|
||||
class Subscription < ActiveRecord::Base
|
||||
class Subscription < ApplicationRecord
|
||||
include NotifyWith::NotificationAttachedObject
|
||||
|
||||
belongs_to :plan
|
||||
|
@ -1,4 +1,4 @@
|
||||
class Tag < ActiveRecord::Base
|
||||
class Tag < ApplicationRecord
|
||||
has_many :user_tags, dependent: :destroy
|
||||
has_many :users, through: :user_tags
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
class Theme < ActiveRecord::Base
|
||||
class Theme < ApplicationRecord
|
||||
has_and_belongs_to_many :projects, join_table: :projects_themes
|
||||
validates :name, presence: true, length: { maximum: 80 }
|
||||
end
|
@ -1,4 +1,4 @@
|
||||
class Ticket < ActiveRecord::Base
|
||||
class Ticket < ApplicationRecord
|
||||
belongs_to :reservation
|
||||
belongs_to :event_price_category
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
class Training < ActiveRecord::Base
|
||||
class Training < ApplicationRecord
|
||||
extend FriendlyId
|
||||
friendly_id :name, use: :slugged
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
class TrainingsAvailability < ActiveRecord::Base
|
||||
class TrainingsAvailability < ApplicationRecord
|
||||
belongs_to :training
|
||||
belongs_to :availability
|
||||
after_destroy :cleanup_availability
|
||||
|
@ -1,4 +1,4 @@
|
||||
class TrainingsPricing < ActiveRecord::Base
|
||||
class TrainingsPricing < ApplicationRecord
|
||||
belongs_to :training
|
||||
belongs_to :group
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# User is a physical or moral person with its authentication parameters
|
||||
# It is linked to the Profile model with hold informations about this person (like address, name, etc.)
|
||||
class User < ActiveRecord::Base
|
||||
class User < ApplicationRecord
|
||||
include NotifyWith::NotificationReceiver
|
||||
include NotifyWith::NotificationAttachedObject
|
||||
# Include default devise modules. Others available are:
|
||||
|
@ -1,4 +1,4 @@
|
||||
class UserTag < ActiveRecord::Base
|
||||
class UserTag < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :tag
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
class UsersCredit < ActiveRecord::Base
|
||||
class UsersCredit < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :credit
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
# user's virtual wallet which can be credited by an admin
|
||||
# all subsequent user's transactions will charge the wallet, as the default payment mean, if the wallet amount > 0
|
||||
# if the wallet amount is not sufficient, a secondary payment mean will be requested (card or cash, depending on the login context)
|
||||
class Wallet < ActiveRecord::Base
|
||||
class Wallet < ApplicationRecord
|
||||
include AmountConcern
|
||||
|
||||
belongs_to :invoicing_profile
|
||||
|
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# track of all transactions payed using the given wallet
|
||||
class WalletTransaction < ActiveRecord::Base
|
||||
class WalletTransaction < ApplicationRecord
|
||||
include AmountConcern
|
||||
|
||||
belongs_to :invoicing_profile
|
||||
|
@ -31,7 +31,7 @@ rails g model LdapMapping ldap_provider:belongs_to local_field:string local_mode
|
||||
Complete the Provider Model ( **app/model/ldap_provider.rb** )
|
||||
|
||||
```ruby
|
||||
class LdapProvider < ActiveRecord::Base
|
||||
class LdapProvider < ApplicationRecord
|
||||
has_one :auth_provider, as: :providable
|
||||
has_many :ldap_mappings, dependent: :destroy
|
||||
accepts_nested_attributes_for :ldap_mappings, allow_destroy: true
|
||||
|
Loading…
x
Reference in New Issue
Block a user