Update to rails 5.2.2.1
This commit is contained in:
parent
1f30bb8a2f
commit
446808da96
36 changed files with 425 additions and 291 deletions
|
|
@ -4,8 +4,7 @@ class BoothRequest < ApplicationRecord
|
|||
belongs_to :booth
|
||||
belongs_to :user
|
||||
|
||||
validates :role,
|
||||
presence: true
|
||||
validates :role, presence: true
|
||||
|
||||
ROLES = %w[submitter responsible].freeze
|
||||
end
|
||||
|
|
|
|||
|
|
@ -94,9 +94,15 @@ class Conference < ApplicationRecord
|
|||
before_create :add_color
|
||||
before_create :create_email_settings
|
||||
|
||||
after_create :create_free_ticket
|
||||
after_update :delete_event_schedules
|
||||
|
||||
after_create do
|
||||
create_free_ticket
|
||||
create_contact
|
||||
create_program
|
||||
create_roles
|
||||
end
|
||||
|
||||
enum ticket_layout: [:portrait, :landscape]
|
||||
|
||||
##
|
||||
|
|
@ -115,7 +121,7 @@ class Conference < ApplicationRecord
|
|||
# Delete all EventSchedules that are not in the hours range
|
||||
# After the conference has been successfully updated
|
||||
def delete_event_schedules
|
||||
if start_hour_changed? || end_hour_changed?
|
||||
if start_hour_previously_changed? || end_hour_previously_changed?
|
||||
event_schedules = program.event_schedules.select do |event_schedule|
|
||||
event_schedule.start_time.hour < start_hour ||
|
||||
event_schedule.end_time.hour > end_hour ||
|
||||
|
|
@ -753,12 +759,6 @@ class Conference < ApplicationRecord
|
|||
((i * big_prime_numbers[component]) % 239 + 16).to_s(16)
|
||||
end
|
||||
|
||||
after_create do
|
||||
create_contact
|
||||
create_program
|
||||
create_roles
|
||||
end
|
||||
|
||||
##
|
||||
# Creates free ticket for the conference
|
||||
# after the conference has been successfully created
|
||||
|
|
@ -1120,7 +1120,6 @@ class Conference < ApplicationRecord
|
|||
#
|
||||
def create_email_settings
|
||||
build_email_settings
|
||||
true
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
class Event < ApplicationRecord
|
||||
include ActiveRecord::Transitions
|
||||
include RevisionCount
|
||||
include ActionView::Helpers::NumberHelper
|
||||
|
||||
has_paper_trail on: [:create, :update], ignore: [:updated_at, :guid, :week], meta: { conference_id: :conference_id }
|
||||
|
||||
acts_as_commentable
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ class Program < ApplicationRecord
|
|||
|
||||
after_create :create_event_types
|
||||
after_create :create_difficulty_levels
|
||||
after_save :unschedule_unfit_events, if: :schedule_interval_changed?
|
||||
after_save :normalize_event_types_length, if: :schedule_interval_changed?
|
||||
after_save :unschedule_unfit_events, if: :schedule_interval_previously_changed?
|
||||
after_save :normalize_event_types_length, if: :schedule_interval_previously_changed?
|
||||
validate :check_languages_format
|
||||
|
||||
# Returns all event_schedules for the selected schedule ordered by start_time
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class Registration < ApplicationRecord
|
|||
end
|
||||
|
||||
def registration_limit_not_exceed
|
||||
if conference.registration_limit > 0 && conference.registrations(:reload).count >= conference.registration_limit
|
||||
if conference.registration_limit > 0 && conference.registrations.reload.count >= conference.registration_limit
|
||||
errors.add(:base, 'Registration limit exceeded')
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,6 +18,6 @@ class Role < ApplicationRecord
|
|||
|
||||
# Needed to ensure that removing all user from role doesn't remove role.
|
||||
def cancel
|
||||
false
|
||||
throw(:abort)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class SurveyQuestion < ActiveRecord::Base
|
|||
ICONS = { boolean: 'dot-circle-o', choice: 'check-square-o', string: 'edit', text: 'align-left', datetime: 'clock-o', numeric: 'slack' }.freeze
|
||||
|
||||
validates :title, presence: true
|
||||
validates :possible_answers, :max_choices, :min_choices, presence: true, if: 'choice?'
|
||||
validates :possible_answers, :max_choices, :min_choices, presence: true, if: :choice?
|
||||
validates :min_choices, numericality: { greater_than_or_equal_to: 1 }, allow_blank: true
|
||||
validates :max_choices, numericality: { greater_than_or_equal_to: 1 }, allow_blank: true
|
||||
|
||||
|
|
|
|||
|
|
@ -11,11 +11,6 @@ class User < ApplicationRecord
|
|||
# prevent N+1 queries with has_cached_role? by preloading roles *always*
|
||||
default_scope { preload(:roles) }
|
||||
|
||||
has_many :physical_tickets, through: :ticket_purchases do
|
||||
def by_conference(conference)
|
||||
where('ticket_purchases.conference_id = ?', conference)
|
||||
end
|
||||
end
|
||||
has_many :users_roles
|
||||
has_many :roles, through: :users_roles, dependent: :destroy
|
||||
|
||||
|
|
@ -74,6 +69,11 @@ class User < ApplicationRecord
|
|||
where(conference: conference, registration_ticket: true).first
|
||||
end
|
||||
end
|
||||
has_many :physical_tickets, through: :ticket_purchases do
|
||||
def by_conference(conference)
|
||||
where('ticket_purchases.conference_id = ?', conference)
|
||||
end
|
||||
end
|
||||
has_many :votes, dependent: :destroy
|
||||
has_many :voted_events, through: :votes, source: :events
|
||||
has_many :subscriptions, dependent: :destroy
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue