mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-18 06:01:12 +00:00
Merge efdb2cd63b into 4b6895f31d
This commit is contained in:
commit
e06a47820c
16 changed files with 118 additions and 25 deletions
|
|
@ -109,6 +109,10 @@ class Ability
|
|||
event.users.include?(user)
|
||||
end
|
||||
|
||||
can :toggle_favorite, Event do |event|
|
||||
event.scheduled?
|
||||
end
|
||||
|
||||
# can manage the commercials of their own events
|
||||
can :manage, Commercial, commercialable_type: 'Event', commercialable_id: user.events.pluck(:id)
|
||||
|
||||
|
|
|
|||
|
|
@ -34,9 +34,12 @@ class Event < ApplicationRecord
|
|||
belongs_to :difficulty_level
|
||||
belongs_to :program
|
||||
|
||||
has_and_belongs_to_many :favourite_users, class_name: 'User'
|
||||
|
||||
accepts_nested_attributes_for :event_users, allow_destroy: true
|
||||
accepts_nested_attributes_for :speakers, allow_destroy: true
|
||||
accepts_nested_attributes_for :users
|
||||
accepts_nested_attributes_for :favourite_users
|
||||
|
||||
before_create :generate_guid
|
||||
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@ class User < ApplicationRecord
|
|||
has_many :booths, through: :booth_requests
|
||||
has_many :survey_replies
|
||||
has_many :survey_submissions
|
||||
has_and_belongs_to_many :favourite_events, class_name: 'Event'
|
||||
|
||||
accepts_nested_attributes_for :roles
|
||||
|
||||
scope :admin, -> { where(is_admin: true) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue