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:
parent
b4fcec07be
commit
efaf07178f
89 changed files with 399 additions and 212 deletions
|
|
@ -1,6 +1,6 @@
|
|||
module Admin
|
||||
class BaseController < ApplicationController
|
||||
before_filter :verify_user_admin
|
||||
before_action :verify_user_admin
|
||||
|
||||
private
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ module Admin
|
|||
class RegistrationsController < Admin::BaseController
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource :registration, through: :conference
|
||||
before_filter :set_user, except: [:index]
|
||||
before_action :set_user, except: [:index]
|
||||
|
||||
def index
|
||||
authorize! :show, Registration.new(conference_id: @conference.id)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
class ApplicationController < ActionController::Base
|
||||
before_filter :set_paper_trail_whodunnit
|
||||
before_action :set_paper_trail_whodunnit
|
||||
include ApplicationHelper
|
||||
add_flash_types :error
|
||||
protect_from_forgery with: :exception
|
||||
before_filter :get_conferences
|
||||
before_filter :store_location
|
||||
protect_from_forgery with: :exception, prepend: true
|
||||
before_action :get_conferences
|
||||
before_action :store_location
|
||||
# Ensure every controller authorizes resource or skips authorization (skip_authorization_check)
|
||||
check_authorization unless: :devise_controller?
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class ConferenceRegistrationsController < ApplicationController
|
||||
before_filter :authenticate_user!, except: [:new, :create]
|
||||
before_action :authenticate_user!, except: [:new, :create]
|
||||
load_resource :conference, find_by: :short_title
|
||||
authorize_resource :conference_registrations, class: Registration, except: [:new, :create]
|
||||
before_action :set_registration, only: [:edit, :update, :destroy, :show]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class SubscriptionsController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
before_action :authenticate_user!
|
||||
load_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource only: [:create, :destroy], through: :conference
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class TicketPurchasesController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
before_action :authenticate_user!
|
||||
load_resource :conference, find_by: :short_title
|
||||
authorize_resource :conference_registrations, class: Registration
|
||||
authorize_resource
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
class TicketsController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
before_action :authenticate_user!
|
||||
load_resource :conference, find_by: :short_title
|
||||
load_resource :ticket, through: :conference
|
||||
authorize_resource :conference_registrations, class: Registration
|
||||
before_filter :check_load_resource, only: :index
|
||||
before_action :check_load_resource, only: :index
|
||||
|
||||
def index; end
|
||||
|
||||
|
|
|
|||
2
app/jobs/application_job.rb
Normal file
2
app/jobs/application_job.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
class ApplicationJob < ActiveJob::Base
|
||||
end
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
class ConferenceCfpUpdateMailJob < ActiveJob::Base
|
||||
class ConferenceCfpUpdateMailJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(conference)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class ConferenceDateUpdateMailJob < ActiveJob::Base
|
||||
class ConferenceDateUpdateMailJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(conference)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class ConferenceRegistrationDateUpdateMailJob < ActiveJob::Base
|
||||
class ConferenceRegistrationDateUpdateMailJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(conference)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class ConferenceScheduleUpdateMailJob < ActiveJob::Base
|
||||
class ConferenceScheduleUpdateMailJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(conference)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class ConferenceVenueUpdateMailJob < ActiveJob::Base
|
||||
class ConferenceVenueUpdateMailJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(conference)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class EventCommentMailJob < ActiveJob::Base
|
||||
class EventCommentMailJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(comment)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
module Ahoy
|
||||
class Event < ActiveRecord::Base
|
||||
class Event < ApplicationRecord
|
||||
self.table_name = 'ahoy_events'
|
||||
|
||||
belongs_to :visit
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Answer < ActiveRecord::Base
|
||||
class Answer < ApplicationRecord
|
||||
has_many :qanswers
|
||||
has_many :questions, through: :qanswers
|
||||
|
||||
|
|
|
|||
3
app/models/application_record.rb
Normal file
3
app/models/application_record.rb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
end
|
||||
|
|
@ -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 }
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class BoothRequest < ActiveRecord::Base
|
||||
class BoothRequest < ApplicationRecord
|
||||
belongs_to :booth
|
||||
belongs_to :user
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Campaign < ActiveRecord::Base
|
||||
class Campaign < ApplicationRecord
|
||||
validates :name, :utm_campaign, presence: true
|
||||
|
||||
has_many :targets, dependent: :nullify
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Commercial < ActiveRecord::Base
|
||||
class Commercial < ApplicationRecord
|
||||
require 'oembed'
|
||||
|
||||
belongs_to :commercialable, polymorphic: true
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Conference < ActiveRecord::Base
|
||||
class Conference < ApplicationRecord
|
||||
include RevisionCount
|
||||
require 'uri'
|
||||
serialize :events_per_week, Hash
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class DifficultyLevel < ActiveRecord::Base
|
||||
class DifficultyLevel < ApplicationRecord
|
||||
belongs_to :program
|
||||
has_many :events, dependent: :nullify
|
||||
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class EventSchedule < ActiveRecord::Base
|
||||
class EventSchedule < ApplicationRecord
|
||||
belongs_to :schedule
|
||||
belongs_to :event
|
||||
belongs_to :room
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class EventType < ActiveRecord::Base
|
||||
class EventType < ApplicationRecord
|
||||
belongs_to :program
|
||||
has_many :events, dependent: :restrict_with_error
|
||||
|
||||
|
|
|
|||
|
|
@ -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]]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class EventsRegistration < ActiveRecord::Base
|
||||
class EventsRegistration < ApplicationRecord
|
||||
belongs_to :registration
|
||||
belongs_to :event
|
||||
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Openid < ActiveRecord::Base
|
||||
class Openid < ApplicationRecord
|
||||
belongs_to :user
|
||||
validates :provider, :uid, presence: true
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Organization < ActiveRecord::Base
|
||||
class Organization < ApplicationRecord
|
||||
resourcify :roles, dependent: :delete_all
|
||||
|
||||
has_paper_trail
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Payment < ActiveRecord::Base
|
||||
class Payment < ApplicationRecord
|
||||
has_many :ticket_purchases
|
||||
belongs_to :user
|
||||
belongs_to :conference
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Qanswer < ActiveRecord::Base
|
||||
class Qanswer < ApplicationRecord
|
||||
belongs_to :question
|
||||
belongs_to :answer, dependent: :delete
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Question < ActiveRecord::Base
|
||||
class Question < ApplicationRecord
|
||||
belongs_to :question_type
|
||||
has_and_belongs_to_many :conferences
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
class QuestionType < ActiveRecord::Base
|
||||
class QuestionType < ApplicationRecord
|
||||
has_many :questions
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Registration < ActiveRecord::Base
|
||||
class Registration < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :conference
|
||||
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Room < ActiveRecord::Base
|
||||
class Room < ApplicationRecord
|
||||
include RevisionCount
|
||||
belongs_to :venue
|
||||
has_many :event_schedules, dependent: :destroy
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Schedule < ActiveRecord::Base
|
||||
class Schedule < ApplicationRecord
|
||||
belongs_to :program
|
||||
belongs_to :track
|
||||
has_many :event_schedules, dependent: :destroy
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Sponsor < ActiveRecord::Base
|
||||
class Sponsor < ApplicationRecord
|
||||
belongs_to :sponsorship_level
|
||||
belongs_to :conference
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class SponsorshipLevel < ActiveRecord::Base
|
||||
class SponsorshipLevel < ApplicationRecord
|
||||
validates :title, presence: true
|
||||
belongs_to :conference
|
||||
acts_as_list scope: :conference
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Subscription < ActiveRecord::Base
|
||||
class Subscription < ApplicationRecord
|
||||
belongs_to :conference
|
||||
belongs_to :user
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Target < ActiveRecord::Base
|
||||
class Target < ApplicationRecord
|
||||
include ActionView::Helpers::TextHelper
|
||||
|
||||
default_scope { order('due_date ASC') }
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class TicketPurchase < ActiveRecord::Base
|
||||
class TicketPurchase < ApplicationRecord
|
||||
belongs_to :ticket
|
||||
belongs_to :user
|
||||
belongs_to :conference
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class TicketScanning < ActiveRecord::Base
|
||||
class TicketScanning < ApplicationRecord
|
||||
belongs_to :physical_ticket
|
||||
|
||||
before_create :mark_user_present
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Track < ActiveRecord::Base
|
||||
class Track < ApplicationRecord
|
||||
include ActiveRecord::Transitions
|
||||
include RevisionCount
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class UsersRole < ActiveRecord::Base
|
||||
class UsersRole < ApplicationRecord
|
||||
belongs_to :role
|
||||
belongs_to :user
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Vchoice < ActiveRecord::Base
|
||||
class Vchoice < ApplicationRecord
|
||||
belongs_to :vday
|
||||
belongs_to :vposition
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Vday < ActiveRecord::Base
|
||||
class Vday < ApplicationRecord
|
||||
belongs_to :conference
|
||||
|
||||
has_many :vchoices
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Visit < ActiveRecord::Base
|
||||
class Visit < ApplicationRecord
|
||||
has_many :ahoy_events, class_name: 'Ahoy::Event'
|
||||
belongs_to :user
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Vote < ActiveRecord::Base
|
||||
class Vote < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :event
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Vposition < ActiveRecord::Base
|
||||
class Vposition < ApplicationRecord
|
||||
belongs_to :conference
|
||||
|
||||
has_many :vchoices
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
= f.input :name, as: :string, required: true
|
||||
= f.input :description, as: :text, input_html: { rows: 10 }, placeholder: 'Decribe about your organization..'
|
||||
= image_tag f.object.picture.thumb.url if f.object.picture?
|
||||
- if @organization.picture
|
||||
- if @organization.picture?
|
||||
= image_tag(@organization.picture.thumb.url, width: '20%')
|
||||
= f.input :picture
|
||||
%p.text-right
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
- @organizations.each do |organization|
|
||||
.col-md-4
|
||||
.thumbnail
|
||||
= image_tag(organization.picture.thumb.url, width: '20%')
|
||||
= image_tag(organization.picture.thumb.url, width: '20%') if organization.picture?
|
||||
.caption
|
||||
%h4
|
||||
= organization.name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue