1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

init StatisticProfileTraining

This commit is contained in:
Sylvain 2019-06-05 16:17:56 +02:00
parent 6f87873b2c
commit f0c5b0eb09
3 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,19 @@
# frozen_string_literal: true
# Stores trainings validated per user (non validated trainings are only recorded in reservations)
class StatisticProfileTraining < ActiveRecord::Base
include NotifyWith::NotificationAttachedObject
belongs_to :statistic_profile
belongs_to :training
after_commit :notify_user_training_valid, on: :create
private
def notify_user_training_valid
NotificationCenter.call type: 'notify_user_training_valid',
receiver: statistic_profile.user,
attached_object: self
end
end

View File

@ -0,0 +1,10 @@
class CreateStatisticProfileTrainings < ActiveRecord::Migration
def change
create_table :statistic_profile_trainings do |t|
t.belongs_to :statistic_profile, index: true, foreign_key: true
t.belongs_to :training, index: true, foreign_key: true
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,9 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
statistic_profile_id:
training_id:
two:
statistic_profile_id:
training_id: