Upgrade to Rails 5

Update config with rails app:update
Update schema.rb rails db:migrate
Add puma
Make jobs and models inherit from ApplicationJob and ApplicationRecord
Update acts_as_list to 0.9.7 in order to fix
"undefined method `sanitize_sql_hash_for_conditions'" error
Update web-console to 2.3.0 to fix a 500 internal server error
Replace before_filter with before_action
Add rails-controller-testing gem
Add prepend: :true to protect_from_forgery in ApplicationController to
avoid ActionController::InvalidAuthenticityToken exceptions
Remove activeuuid
Update formtastic to 3.1.5 to fix deprecation warnings and issues
with the Input class
Update ahoy_matey to 1.6.0
Update cancancan to 2.0.0 to fix issues with malformed sql queries
Fix program spec
Fix issue with the picture being nil in admin/Organizations#new and #edit
and Organizations#show
Fix ActiveRecord::Base.raise_in_transactional_callbacks= deprecation
warning by removing an unnecessary line in application.rb
Fix failing versions specs
This commit is contained in:
AEtherC0r3 2017-09-05 22:23:34 +03:00 committed by Stella Rouzi
parent b4fcec07be
commit efaf07178f
89 changed files with 399 additions and 212 deletions

View file

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

View file

@ -1,4 +1,4 @@
class Answer < ActiveRecord::Base
class Answer < ApplicationRecord
has_many :qanswers
has_many :questions, through: :qanswers

View file

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

View file

@ -1,4 +1,4 @@
class Booth < ActiveRecord::Base
class Booth < ApplicationRecord
include ActiveRecord::Transitions
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }

View file

@ -1,4 +1,4 @@
class BoothRequest < ActiveRecord::Base
class BoothRequest < ApplicationRecord
belongs_to :booth
belongs_to :user

View file

@ -1,4 +1,4 @@
class Campaign < ActiveRecord::Base
class Campaign < ApplicationRecord
validates :name, :utm_campaign, presence: true
has_many :targets, dependent: :nullify

View file

@ -1,6 +1,6 @@
# cannot delete program if there are events submitted
class Cfp < ActiveRecord::Base
class Cfp < ApplicationRecord
TYPES = %w(events booths tracks).freeze
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }

View file

@ -1,4 +1,4 @@
class Comment < ActiveRecord::Base
class Comment < ApplicationRecord
acts_as_nested_set scope: %i(commentable_id commentable_type)
validates :body, presence: true
validates :user, presence: true

View file

@ -1,4 +1,4 @@
class Commercial < ActiveRecord::Base
class Commercial < ApplicationRecord
require 'oembed'
belongs_to :commercialable, polymorphic: true

View file

@ -1,4 +1,4 @@
class Conference < ActiveRecord::Base
class Conference < ApplicationRecord
include RevisionCount
require 'uri'
serialize :events_per_week, Hash

View file

@ -1,4 +1,4 @@
class Contact < ActiveRecord::Base
class Contact < ApplicationRecord
has_paper_trail on: [:update], ignore: [:updated_at], meta: { conference_id: :conference_id }
belongs_to :conference

View file

@ -1,4 +1,4 @@
class DifficultyLevel < ActiveRecord::Base
class DifficultyLevel < ApplicationRecord
belongs_to :program
has_many :events, dependent: :nullify

View file

@ -1,4 +1,4 @@
class EmailSettings < ActiveRecord::Base
class EmailSettings < ApplicationRecord
belongs_to :conference
has_paper_trail on: [:update], ignore: [:updated_at], meta: { conference_id: :conference_id }

View file

@ -1,4 +1,4 @@
class Event < ActiveRecord::Base
class Event < ApplicationRecord
include ActiveRecord::Transitions
include RevisionCount
has_paper_trail on: [:create, :update], ignore: [:updated_at, :guid, :week], meta: { conference_id: :conference_id }

View file

@ -1,4 +1,4 @@
class EventSchedule < ActiveRecord::Base
class EventSchedule < ApplicationRecord
belongs_to :schedule
belongs_to :event
belongs_to :room

View file

@ -1,4 +1,4 @@
class EventType < ActiveRecord::Base
class EventType < ApplicationRecord
belongs_to :program
has_many :events, dependent: :restrict_with_error

View file

@ -1,4 +1,4 @@
class EventUser < ActiveRecord::Base
class EventUser < ApplicationRecord
# TODO: Do we need these roles?
ROLES = [%w[Speaker speaker], %w[Submitter submitter], %w[Moderator moderator]]

View file

@ -1,4 +1,4 @@
class EventsRegistration < ActiveRecord::Base
class EventsRegistration < ApplicationRecord
belongs_to :registration
belongs_to :event

View file

@ -1,4 +1,4 @@
class Lodging < ActiveRecord::Base
class Lodging < ApplicationRecord
belongs_to :conference
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }

View file

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

View file

@ -1,4 +1,4 @@
class Organization < ActiveRecord::Base
class Organization < ApplicationRecord
resourcify :roles, dependent: :delete_all
has_paper_trail

View file

@ -1,4 +1,4 @@
class Payment < ActiveRecord::Base
class Payment < ApplicationRecord
has_many :ticket_purchases
belongs_to :user
belongs_to :conference

View file

@ -1,4 +1,4 @@
class PhysicalTicket < ActiveRecord::Base
class PhysicalTicket < ApplicationRecord
belongs_to :ticket_purchase
has_one :ticket, through: :ticket_purchase
has_one :conference, through: :ticket_purchase

View file

@ -1,6 +1,6 @@
# cannot delete program if there are events submitted
class Program < ActiveRecord::Base
class Program < ApplicationRecord
has_paper_trail on: [:update], ignore: [:updated_at], meta: { conference_id: :conference_id }
belongs_to :conference

View file

@ -1,4 +1,4 @@
class Qanswer < ActiveRecord::Base
class Qanswer < ApplicationRecord
belongs_to :question
belongs_to :answer, dependent: :delete

View file

@ -1,4 +1,4 @@
class Question < ActiveRecord::Base
class Question < ApplicationRecord
belongs_to :question_type
has_and_belongs_to_many :conferences

View file

@ -1,3 +1,3 @@
class QuestionType < ActiveRecord::Base
class QuestionType < ApplicationRecord
has_many :questions
end

View file

@ -1,4 +1,4 @@
class Registration < ActiveRecord::Base
class Registration < ApplicationRecord
belongs_to :user
belongs_to :conference

View file

@ -1,4 +1,4 @@
class RegistrationPeriod < ActiveRecord::Base
class RegistrationPeriod < ApplicationRecord
belongs_to :conference
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }

View file

@ -1,4 +1,4 @@
class Resource < ActiveRecord::Base
class Resource < ApplicationRecord
belongs_to :conference
validates :name, :used, :quantity, presence: true
validates :used, :quantity, numericality: { greater_than_or_equal_to: 0, only_integer: true }

View file

@ -1,4 +1,4 @@
class Role < ActiveRecord::Base
class Role < ApplicationRecord
belongs_to :resource, polymorphic: true
has_many :users_roles
has_many :users, through: :users_roles

View file

@ -1,4 +1,4 @@
class Room < ActiveRecord::Base
class Room < ApplicationRecord
include RevisionCount
belongs_to :venue
has_many :event_schedules, dependent: :destroy

View file

@ -1,4 +1,4 @@
class Schedule < ActiveRecord::Base
class Schedule < ApplicationRecord
belongs_to :program
belongs_to :track
has_many :event_schedules, dependent: :destroy

View file

@ -1,4 +1,4 @@
class Splashpage < ActiveRecord::Base
class Splashpage < ApplicationRecord
belongs_to :conference
has_paper_trail ignore: [:updated_at], meta: { conference_id: :conference_id }

View file

@ -1,4 +1,4 @@
class Sponsor < ActiveRecord::Base
class Sponsor < ApplicationRecord
belongs_to :sponsorship_level
belongs_to :conference

View file

@ -1,4 +1,4 @@
class SponsorshipLevel < ActiveRecord::Base
class SponsorshipLevel < ApplicationRecord
validates :title, presence: true
belongs_to :conference
acts_as_list scope: :conference

View file

@ -1,4 +1,4 @@
class Subscription < ActiveRecord::Base
class Subscription < ApplicationRecord
belongs_to :conference
belongs_to :user

View file

@ -1,4 +1,4 @@
class Target < ActiveRecord::Base
class Target < ApplicationRecord
include ActionView::Helpers::TextHelper
default_scope { order('due_date ASC') }

View file

@ -1,4 +1,4 @@
class Ticket < ActiveRecord::Base
class Ticket < ApplicationRecord
belongs_to :conference
has_many :ticket_purchases, dependent: :destroy
has_many :buyers, -> { distinct }, through: :ticket_purchases, source: :user

View file

@ -1,4 +1,4 @@
class TicketPurchase < ActiveRecord::Base
class TicketPurchase < ApplicationRecord
belongs_to :ticket
belongs_to :user
belongs_to :conference

View file

@ -1,4 +1,4 @@
class TicketScanning < ActiveRecord::Base
class TicketScanning < ApplicationRecord
belongs_to :physical_ticket
before_create :mark_user_present

View file

@ -1,4 +1,4 @@
class Track < ActiveRecord::Base
class Track < ApplicationRecord
include ActiveRecord::Transitions
include RevisionCount

View file

@ -4,7 +4,7 @@ end
class UserDisabled < StandardError
end
class User < ActiveRecord::Base
class User < ApplicationRecord
rolify
has_many :physical_tickets, through: :ticket_purchases do
def by_conference(conference)

View file

@ -1,4 +1,4 @@
class UsersRole < ActiveRecord::Base
class UsersRole < ApplicationRecord
belongs_to :role
belongs_to :user

View file

@ -1,4 +1,4 @@
class Vchoice < ActiveRecord::Base
class Vchoice < ApplicationRecord
belongs_to :vday
belongs_to :vposition

View file

@ -1,4 +1,4 @@
class Vday < ActiveRecord::Base
class Vday < ApplicationRecord
belongs_to :conference
has_many :vchoices

View file

@ -1,4 +1,4 @@
class Venue < ActiveRecord::Base
class Venue < ApplicationRecord
belongs_to :conference
has_one :commercial, as: :commercialable, dependent: :destroy
has_many :rooms, dependent: :destroy

View file

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

View file

@ -1,4 +1,4 @@
class Vote < ActiveRecord::Base
class Vote < ApplicationRecord
belongs_to :user
belongs_to :event

View file

@ -1,4 +1,4 @@
class Vposition < ActiveRecord::Base
class Vposition < ApplicationRecord
belongs_to :conference
has_many :vchoices