Use only new hash syntax

This commit is contained in:
Artem Chernikov 2014-07-21 14:49:05 +02:00
parent 3901973fd6
commit 5289f41eb5
72 changed files with 179 additions and 181 deletions

View file

@ -1,6 +1,7 @@
inherit_from: .rubocop_todo.yml
Style/HashSyntax:
Enabled: true
EnforcedStyle: ruby19
# Things deprecated in current ruby API
@ -75,13 +76,10 @@ Lint/UnusedMethodArgument:
Lint/UselessAssignment:
Enabled: true
# Do not use variables in void context
Lint/Void:
Enabled: true
# Offense count: 17
Style/AccessorMethodName:
Enabled: false
AllCops:
Include:
- Rakefile

View file

@ -8,9 +8,9 @@ class Admin::DietchoicesController < ApplicationController
def update
begin
@conference.update_attributes!(params[:conference])
redirect_to(admin_conference_dietary_list_path(:conference_id => @conference.short_title), :notice => 'Dietary choices were successfully updated.')
redirect_to(admin_conference_dietary_list_path(conference_id: @conference.short_title), notice: 'Dietary choices were successfully updated.')
rescue => e
redirect_to(admin_conference_dietary_list_path(:conference_id => @conference.short_title), :alert => "Dietary choices update failed: #{e.message}")
redirect_to(admin_conference_dietary_list_path(conference_id: @conference.short_title), alert: "Dietary choices update failed: #{e.message}")
end
end
end

View file

@ -12,18 +12,18 @@ class Admin::DifficultyLevelsController < ApplicationController
@conference.use_difficulty_levels = false
@conference.save!
flash[:error] = "You cannot enable the usage of difficulty levels without having set any levels."
redirect_to(admin_conference_difficulty_levels_path(:conference_id => @conference.short_title))
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title))
rescue ActiveRecord::RecordInvalid
flash[:error] = "Something went wrong. Difficulty Levels update failed."
redirect_to(admin_conference_difficulty_levels_path(:conference_id => @conference.short_title))
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title))
end
else
flash[:notice] = "Difficulty Levels were successfully updated."
redirect_to(admin_conference_difficulty_levels_path(:conference_id => @conference.short_title))
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title))
end
else
flash[:error] = "Difficulty Levels update failed."
redirect_to(admin_conference_difficulty_levels_path(:conference_id => @conference.short_title))
redirect_to(admin_conference_difficulty_levels_path(conference_id: @conference.short_title))
end
end
end

View file

@ -3,7 +3,7 @@ class Admin::QuestionsController < ApplicationController
def index
@conference = Conference.find_by(short_title: params[:conference_id])
@questions = Question.where(:global => true).all | Question.where(:conference_id => @conference.id)
@questions = Question.where(global: true).all | Question.where(conference_id: @conference.id)
@questions_conference = @conference.questions
@new_question = @conference.questions.new
end
@ -34,7 +34,7 @@ class Admin::QuestionsController < ApplicationController
@question = Question.find(params[:id])
if @question.global == true && !has_role?(current_user, "Admin")
redirect_to(admin_conference_questions_path(:conference_id => @conference.short_title), :alert => "Sorry, you cannot edit global questions. Create a new one.")
redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), alert: "Sorry, you cannot edit global questions. Create a new one.")
end
end
@ -45,9 +45,9 @@ class Admin::QuestionsController < ApplicationController
@question = Question.find(params[:id])
if @question.update_attributes(params[:question])
redirect_to(admin_conference_questions_path(:conference_id => @conference.short_title), :notice => "Question '#{@question.title}' for #{@conference.short_title} successfully updated.")
redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), notice: "Question '#{@question.title}' for #{@conference.short_title} successfully updated.")
else
redirect_to(admin_conference_questions_path(:conference_id => @conference.short_title), :notice => "Update of questions for #{@conference.short_title} failed.")
redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), notice: "Update of questions for #{@conference.short_title} failed.")
end
end
@ -56,9 +56,9 @@ class Admin::QuestionsController < ApplicationController
@conference = Conference.find_by(short_title: params[:conference_id])
if @conference.update_attributes(params[:conference])
redirect_to(admin_conference_questions_path(:conference_id => @conference.short_title), :notice => "Questions for #{@conference.short_title} successfully updated.")
redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), notice: "Questions for #{@conference.short_title} successfully updated.")
else
redirect_to(admin_conference_questions_path(:conference_id => @conference.short_title), :notice => "Update of questions for #{@conference.short_title} failed.")
redirect_to(admin_conference_questions_path(conference_id: @conference.short_title), notice: "Update of questions for #{@conference.short_title} failed.")
end
end
@ -90,7 +90,7 @@ class Admin::QuestionsController < ApplicationController
flash[:error] = "You must be an admin to delete a question."
end
@questions = Question.where(:global => true).all | Question.where(:conference_id => @conference.id)
@questions = Question.where(global: true).all | Question.where(conference_id: @conference.id)
@questions_conference = @conference.questions
end
end

View file

@ -7,9 +7,9 @@ class Admin::SocialEventsController < ApplicationController
def update
if @conference.update_attributes(params[:conference])
redirect_to(admin_conference_social_events_path(:conference_id => @conference.short_title), :notice => 'Social events were successfully updated.')
redirect_to(admin_conference_social_events_path(conference_id: @conference.short_title), notice: 'Social events were successfully updated.')
else
redirect_to(admin_conference_social_events_path(:conference_id => @conference.short_title), :notice => 'Social events update failed.')
redirect_to(admin_conference_social_events_path(conference_id: @conference.short_title), notice: 'Social events update failed.')
end
end
end

View file

@ -8,9 +8,9 @@ class Admin::SupporterLevelsController < ApplicationController
def update
begin
@conference.update_attributes!(params[:conference])
redirect_to(admin_conference_supporter_levels_path(:conference_id => @conference.short_title), :notice => 'Supporter levels were successfully updated.')
redirect_to(admin_conference_supporter_levels_path(conference_id: @conference.short_title), notice: 'Supporter levels were successfully updated.')
rescue => e
redirect_to(admin_conference_supporter_levels_path(:conference_id => @conference.short_title), :alert => "Supporter levels update failed: #{e.message}")
redirect_to(admin_conference_supporter_levels_path(conference_id: @conference.short_title), alert: "Supporter levels update failed: #{e.message}")
end
end
end

View file

@ -11,6 +11,6 @@ class Admin::SupportersController < ApplicationController
def create
params[:supporter_registration][:conference_id] = @conference.id
SupporterRegistration.create!(params[:supporter_registration])
redirect_to(admin_conference_supporters_path(:conference_id => @conference.short_title), :notice => "Supporter added")
redirect_to(admin_conference_supporters_path(conference_id: @conference.short_title), notice: "Supporter added")
end
end

View file

@ -9,7 +9,7 @@ class Admin::VolunteersController < ApplicationController
if @conference.use_vpositions
@volunteers = @conference.registrations.joins(:vchoices).uniq
else
@volunteers = @conference.registrations.where(:volunteer => true)
@volunteers = @conference.registrations.where(volunteer: true)
end
end
@ -17,9 +17,9 @@ class Admin::VolunteersController < ApplicationController
@conference = Conference.find_by(short_title: params[:conference_id])
begin
@conference.update_attributes!(params[:conference])
redirect_to(admin_conference_volunteers_info_path(:conference_id => params[:conference_id]), :notice => "Volunteering options were successfully updated.")
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), notice: "Volunteering options were successfully updated.")
rescue => e
redirect_to(admin_conference_volunteers_info_path(:conference_id => params[:conference_id]), :alert => "Volunteering options update failed: #{e.message}")
redirect_to(admin_conference_volunteers_info_path(conference_id: params[:conference_id]), alert: "Volunteering options update failed: #{e.message}")
end
end
end

View file

@ -7,6 +7,6 @@ class Api::V1::ConferencesController < Api::BaseController
else
conferences = Conference.find_all_by_guid(params[:conference_id])
end
render :json => conferences, :serializer => ConferencesArraySerializer
render json: conferences, serializer: ConferencesArraySerializer
end
end

View file

@ -70,7 +70,7 @@ class ApplicationController < ActionController::Base
rescue_from CanCan::AccessDenied do |exception|
Rails.logger.debug("Access denied!")
redirect_to root_path, :alert => exception.message
redirect_to root_path, alert: exception.message
end
helper_method :organizer_or_admin?

View file

@ -1,6 +1,6 @@
class EventAttachmentsController < ApplicationController
before_filter :verify_user
skip_before_filter :verify_user, :only => [:show]
skip_before_filter :verify_user, only: [:show]
def index
@proposal = Event.find(params[:proposal_id])
@ -67,9 +67,9 @@ class EventAttachmentsController < ApplicationController
respond_to do |format|
if @upload.save
format.html {
render :json => [@upload.to_jq_upload].to_json,
:content_type => 'text/html',
:layout => false
render json: [@upload.to_jq_upload].to_json,
content_type: 'text/html',
layout: false
}
format.json do
render json: [@upload.to_jq_upload].to_json, status: :created,
@ -108,7 +108,7 @@ class EventAttachmentsController < ApplicationController
respond_to do |format|
format.html { redirect_back_or_to conference_proposal_index_path(@conference.short_title), :notice => "Deleted successfully attachment '#{@upload.title}' for proposal '#{@proposal.title}'" }
format.html { redirect_back_or_to conference_proposal_index_path(@conference.short_title), notice: "Deleted successfully attachment '#{@upload.title}' for proposal '#{@proposal.title}'" }
format.json { head :no_content }
end

View file

@ -2,7 +2,7 @@ class ScheduleController < ApplicationController
layout "application"
def index
@conference = Conference.includes(:rooms, {:events => [:speakers, :track, :event_type]}).where("conferences.short_title" => params[:conference_id]).first
@conference = Conference.includes(:rooms, {events: [:speakers, :track, :event_type]}).where("conferences.short_title" => params[:conference_id]).first
@rooms = @conference.rooms
@events = @conference.events
@dates = @conference.start_date..@conference.end_date

View file

@ -126,15 +126,15 @@ module ApplicationHelper
end
def add_association_link(association_name, form_builder, div_class, html_options = {})
link_to_add_association "Add " + association_name.to_s.singularize, form_builder, div_class, html_options.merge(:class => "assoc btn btn-success")
link_to_add_association "Add " + association_name.to_s.singularize, form_builder, div_class, html_options.merge(class: "assoc btn btn-success")
end
def remove_association_link(association_name, form_builder)
link_to_remove_association("Remove " + association_name.to_s.singularize, form_builder, :class => "assoc btn btn-danger") + tag(:hr)
link_to_remove_association("Remove " + association_name.to_s.singularize, form_builder, class: "assoc btn btn-danger") + tag(:hr)
end
def dynamic_association(association_name, title, form_builder, options = {})
render "shared/dynamic_association", :association_name => association_name, :title => title, :f => form_builder, :hint => options[:hint]
render "shared/dynamic_association", association_name: association_name, title: title, f: form_builder, hint: options[:hint]
end
def has_role?(current_user, role)

View file

@ -55,10 +55,10 @@ class Mailbot < ActionMailer::Base
end
def build_email(conference, to, subject, body)
mail(:to => to,
:from => conference.contact_email,
:reply_to => conference.contact_email,
:subject => subject,
:body => body)
mail(to: to,
from: conference.contact_email,
reply_to: conference.contact_email,
subject: subject,
body: body)
end
end

View file

@ -2,7 +2,7 @@ class Answer < ActiveRecord::Base
attr_accessible :title
has_many :qanswers
has_many :questions, :through => :qanswers
has_many :questions, through: :qanswers
validates :title, :presence => true
validates :title, presence: true
end

View file

@ -5,7 +5,7 @@ class CallForPapers < ActiveRecord::Base
belongs_to :conference
validates_presence_of :start_date, :end_date
validates :rating, :numericality => { :greater_than_or_equal_to => 0, :less_than_or_equal_to => 10 }
validates :rating, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 10 }
##
# Calculates how many weeks the call for paper is.

View file

@ -1,5 +1,5 @@
class Comment < ActiveRecord::Base
acts_as_nested_set :scope => [:commentable_id, :commentable_type]
acts_as_nested_set scope: [:commentable_id, :commentable_type]
attr_accessible :commentable, :body, :user_id
validates_presence_of :body
validates_presence_of :user
@ -8,7 +8,7 @@ class Comment < ActiveRecord::Base
# want user to vote on the quality of comments.
#acts_as_votable
belongs_to :commentable, :polymorphic => true
belongs_to :commentable, polymorphic: true
# NOTE: Comments belong to a user
belongs_to :user
@ -18,9 +18,9 @@ class Comment < ActiveRecord::Base
# example in readme
def self.build_from(obj, user_id, comment)
new \
:commentable => obj,
:body => comment,
:user_id => user_id
commentable: obj,
body: comment,
user_id: user_id
end
#helper method to check if a comment has children
@ -31,13 +31,13 @@ class Comment < ActiveRecord::Base
# Helper class method to lookup all comments assigned
# to all commentable types for a given user.
scope :find_comments_by_user, lambda { |user|
where(:user_id => user.id).order('created_at DESC')
where(user_id: user.id).order('created_at DESC')
}
# Helper class method to look up all comments for
# commentable class name and commentable id.
scope :find_comments_for_commentable, lambda { |commentable_str, commentable_id|
where(:commentable_type => commentable_str.to_s, :commentable_id => commentable_id).order('created_at DESC')
where(commentable_type: commentable_str.to_s, commentable_id: commentable_id).order('created_at DESC')
}
# Helper class method to look up a commentable object

View file

@ -89,7 +89,7 @@ class Conference < ActiveRecord::Base
format: URI::regexp(%w(http https)), allow_blank: true
validates_uniqueness_of :short_title
validates_format_of :short_title, :with => /\A[a-zA-Z0-9_-]*\z/
validates_format_of :short_title, with: /\A[a-zA-Z0-9_-]*\z/
before_create :generate_guid
before_create :create_venue
before_create :create_event_types

View file

@ -4,5 +4,5 @@ class DifficultyLevel < ActiveRecord::Base
belongs_to :conference
has_many :events
validates :title, :presence => true
validates :title, presence: true
end

View file

@ -4,7 +4,7 @@ class EventAttachment < ActiveRecord::Base
belongs_to :event
attr_accessible :public, :attachment, :event_id, :title
has_attached_file :attachment, :path => ":rails_root/storage/:rails_env/attachments/:id/:style/:basename.:extension"
has_attached_file :attachment, path: ":rails_root/storage/:rails_env/attachments/:id/:style/:basename.:extension"
include Rails.application.routes.url_helpers
def to_jq_upload

View file

@ -4,7 +4,7 @@ class EventType < ActiveRecord::Base
belongs_to :conference
validates :title, presence: true
validates :length, :numericality => {:greater_than => 0}
validates :length, numericality: {greater_than: 0}
validates :minimum_abstract_length, presence: true
validates :maximum_abstract_length, presence: true

View file

@ -2,7 +2,7 @@ class Qanswer < ActiveRecord::Base
attr_accessible :question_id, :answer_id
belongs_to :question
belongs_to :answer, :dependent => :delete
belongs_to :answer, dependent: :delete
has_and_belongs_to_many :registrations
end

View file

@ -4,11 +4,11 @@ class Question < ActiveRecord::Base
belongs_to :question_type
has_and_belongs_to_many :conferences
has_many :qanswers, :dependent => :delete_all
has_many :answers, :through => :qanswers, :dependent => :delete_all
has_many :qanswers, dependent: :delete_all
has_many :answers, through: :qanswers, dependent: :delete_all
validates :title, :presence => true
validates :answers, :presence => true
validates :title, presence: true
validates :answers, presence: true
accepts_nested_attributes_for :answers, :allow_destroy => true
accepts_nested_attributes_for :answers, allow_destroy: true
end

View file

@ -4,5 +4,5 @@ class Vday < ActiveRecord::Base
belongs_to :conference
has_many :vchoices
has_many :vpositions, :through => :vchoices, :dependent => :destroy
has_many :vpositions, through: :vchoices, dependent: :destroy
end

View file

@ -20,7 +20,7 @@ class Venue < ActiveRecord::Base
def generate_guid
loop do
@guid = SecureRandom.urlsafe_base64
break if !Venue.where(:guid => guid).any?
break if !Venue.where(guid: guid).any?
end
self.guid = @guid
end

View file

@ -4,7 +4,7 @@ class Vposition < ActiveRecord::Base
belongs_to :conference
has_many :vchoices
has_many :vdays, :through => :vchoices
has_many :vdays, through: :vchoices
validates_presence_of :title, :vdays
end

View file

@ -5,7 +5,7 @@ include ActionView::Helpers::NumberHelper
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
Bundler.require(*Rails.groups(assets: %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end

View file

@ -12,7 +12,7 @@ set :repository, 'https://github.com/openSUSE/osem.git'
# They will be linked in the 'deploy:link_shared_paths' step.
set :shared_paths, %w{ config/database.yml log public/system config/secrets.yml config/config.yml tmp}
task :setup => :environment do
task setup: :environment do
queue! %[mkdir -p "#{deploy_to}/shared/log"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"]
@ -27,7 +27,7 @@ task :setup => :environment do
end
desc 'Deploys the current version to the server.'
task :deploy => :environment do
task deploy: :environment do
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
@ -43,7 +43,7 @@ task :deploy => :environment do
end
desc 'Notifies the exception handler of the deploy.'
task :notify_errbit => :environment do
task notify_errbit: :environment do
revision = `git rev-parse HEAD`.strip
user = ENV['USER']
queue "bundle exec rake hoptoad:deploy TO=#{rails_env} REVISION=#{revision} REPO=#{repository} USER=#{user}"

View file

@ -35,6 +35,6 @@ Osem::Application.configure do
config.eager_load = false
# Set the detault url for action mailer
config.action_mailer.default_url_options = { :host => CONFIG['url_for_emails'] }
config.action_mailer.default_url_options = { host: CONFIG['url_for_emails'] }
end

View file

@ -67,5 +67,5 @@ Osem::Application.configure do
config.active_support.deprecation = :notify
# Set the detault url for action mailer
config.action_mailer.default_url_options = { :host => CONFIG['url_for_emails'] }
config.action_mailer.default_url_options = { host: CONFIG['url_for_emails'] }
end

View file

@ -70,7 +70,7 @@ Osem::Application.routes.draw do
patch :restart
get :vote
end
resource :speaker, :only => [:edit, :update]
resource :speaker, only: [:edit, :update]
end
resources :supporters
@ -79,11 +79,11 @@ Osem::Application.routes.draw do
resources :conference, only: [:show] do
resources :proposal do
resources :event_attachment, :controller => "event_attachments"
resources :event_attachment, controller: "event_attachments"
patch '/confirm' => 'proposal#confirm'
patch '/restart' => 'proposal#restart'
end
resource :schedule, :only => [] do
resource :schedule, only: [] do
get "/" => "schedule#index"
end
member do
@ -96,17 +96,17 @@ Osem::Application.routes.draw do
namespace :api, defaults: {format: 'json'} do
namespace :v1 do
resources :conferences, :only => :index do
resources :conferences, :only => :index
resources :rooms, :only => :index
resources :tracks, :only => :index
resources :speakers, :only => :index
resources :events, :only => :index
resources :conferences, only: :index do
resources :conferences, only: :index
resources :rooms, only: :index
resources :tracks, only: :index
resources :speakers, only: :index
resources :events, only: :index
end
resources :rooms, :only => :index
resources :tracks, :only => :index
resources :speakers, :only => :index
resources :events, :only => :index
resources :rooms, only: :index
resources :tracks, only: :index
resources :speakers, only: :index
resources :events, only: :index
end
end

View file

@ -2,8 +2,8 @@ class DeviseCreateUsers < ActiveRecord::Migration
def up
create_table(:users) do |t|
## Database authenticatable
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.string :reset_password_token
@ -13,7 +13,7 @@ class DeviseCreateUsers < ActiveRecord::Migration
t.datetime :remember_created_at
## Trackable
t.integer :sign_in_count, :default => 0
t.integer :sign_in_count, default: 0
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
@ -36,9 +36,9 @@ class DeviseCreateUsers < ActiveRecord::Migration
t.timestamps
end
add_index :users, :email, :unique => true
add_index :users, :reset_password_token, :unique => true
add_index :users, :confirmation_token, :unique => true
add_index :users, :email, unique: true
add_index :users, :reset_password_token, unique: true
add_index :users, :confirmation_token, unique: true
# add_index :users, :unlock_token, :unique => true
# add_index :users, :authentication_token, :unique => true
end

View file

@ -1,17 +1,17 @@
class CreateConferencesTable < ActiveRecord::Migration
def up
create_table :conferences do |t|
t.string :guid, :null => false
t.string :title, :null => false
t.string :short_title, :null => false
t.string :guid, null: false
t.string :title, null: false
t.string :short_title, null: false
t.string :social_tag
t.string :contact_email, :null => false
t.string :timezone, :null => false
t.string :contact_email, null: false
t.string :timezone, null: false
t.string :html_export_path
t.date :start_date, :null => false
t.date :end_date, :null => false
t.boolean :cfp_open, :default => false
t.boolean :registration_open, :default => false
t.date :start_date, null: false
t.date :end_date, null: false
t.boolean :cfp_open, default: false
t.boolean :registration_open, default: false
t.references :venue
t.timestamps

View file

@ -1,12 +1,12 @@
class CreatePeopleTable < ActiveRecord::Migration
def up
create_table :people do |t|
t.string :guid, :null => false
t.string :first_name, :default => ""
t.string :last_name, :default => ""
t.string :public_name, :default => ""
t.string :company, :default => ""
t.string :email, :null => false
t.string :guid, null: false
t.string :first_name, default: ""
t.string :last_name, default: ""
t.string :public_name, default: ""
t.string :company, default: ""
t.string :email, null: false
t.boolean :email_public
t.string :avatar_file_name
t.string :avatar_content_type

View file

@ -1,11 +1,11 @@
class CreateRoomsTable < ActiveRecord::Migration
def up
create_table :rooms do |t|
t.string :guid, :null => false
t.string :guid, null: false
t.references :conference
t.string :name, :null => false
t.string :name, null: false
t.integer :size
t.boolean :public, :default => true
t.boolean :public, default: true
end
end

View file

@ -1,11 +1,11 @@
class CreateTracksTable < ActiveRecord::Migration
def up
create_table :tracks do |t|
t.string :guid, :null => false
t.string :guid, null: false
t.references :conference
t.string :name, :null => false
t.string :name, null: false
t.text :description
t.string :color, :default => "#ffffff"
t.string :color, default: "#ffffff"
t.timestamps
end

View file

@ -1,19 +1,19 @@
class CreateEventsTable < ActiveRecord::Migration
def up
create_table :events do |t|
t.string :guid, :null => false
t.string :guid, null: false
t.references :conference
t.references :event_type
t.string :title, :null => false
t.string :title, null: false
t.string :subtitle
t.integer :time_slots
t.string :state, :null => false, :default => "new"
t.string :progress, :null => false, :default => "new"
t.string :state, null: false, default: "new"
t.string :progress, null: false, default: "new"
t.string :language
t.datetime :start_time
t.text :abstract
t.text :description
t.boolean :public, :default => true
t.boolean :public, default: true
t.string :logo_file_name
t.string :logo_content_type
t.integer :logo_file_size

View file

@ -2,8 +2,8 @@ class CreateEventTypes < ActiveRecord::Migration
def up
create_table :event_types do |t|
t.references :conference
t.string :title, :null => false
t.integer :length, :default => 30
t.string :title, null: false
t.integer :length, default: 30
end
end

View file

@ -4,7 +4,7 @@ class CreateEventPeopleTable < ActiveRecord::Migration
t.references :proposal
t.references :person
t.references :event
t.string :event_role, :null => false, :default => "participant"
t.string :event_role, null: false, default: "participant"
t.string :comment
t.timestamps

View file

@ -1,6 +1,6 @@
class UserRolesTable < ActiveRecord::Migration
def self.up
create_table :roles_users, :id => false do |t|
create_table :roles_users, id: false do |t|
t.references :role, :user
end
end

View file

@ -1,10 +1,10 @@
class CreateCfpTable < ActiveRecord::Migration
def up
create_table :call_for_papers do |t|
t.date :start_date, :null => false
t.date :end_date, :null => false
t.date :hard_deadline, :null => false
t.text :description, :null => false
t.date :start_date, null: false
t.date :end_date, null: false
t.date :hard_deadline, null: false
t.text :description, null: false
t.references :conference
t.timestamps

View file

@ -4,9 +4,9 @@ class CreateRegistrationsTable < ActiveRecord::Migration
t.references :person
t.references :conference
t.boolean :attending_social_events, :default => true
t.boolean :attending_social_events_with_partner, :default => false
t.boolean :using_affiliated_lodging, :default => true
t.boolean :attending_social_events, default: true
t.boolean :attending_social_events_with_partner, default: false
t.boolean :using_affiliated_lodging, default: true
t.date :arrival
t.date :departure

View file

@ -1,9 +1,9 @@
class CreateComments < ActiveRecord::Migration
def self.up
create_table :comments do |t|
t.string :title, :limit => 50, :default => ""
t.string :title, limit: 50, default: ""
t.text :comment
t.references :commentable, :polymorphic => true
t.references :commentable, polymorphic: true
t.references :user
t.timestamps
end

View file

@ -2,12 +2,12 @@ class CreateEventAttachmentsTable < ActiveRecord::Migration
def up
create_table :event_attachments do |t|
t.references :event
t.string :title, :null => false
t.string :title, null: false
t.string :attachment_file_name
t.string :attachment_content_type
t.integer :attachment_file_size
t.datetime :attachment_updated_at
t.boolean :public, :default => true
t.boolean :public, default: true
t.timestamps
end
end

View file

@ -5,7 +5,7 @@ class RemoveCfpAndRegBooleansFromConferences < ActiveRecord::Migration
end
def down
add_column :conferences, :cfp_open, :default => false
add_column :registration_open, :default => false
add_column :conferences, :cfp_open, default: false
add_column :registration_open, default: false
end
end

View file

@ -1,9 +1,9 @@
class CreateVersions < ActiveRecord::Migration
def self.up
create_table :versions do |t|
t.string :item_type, :null => false
t.integer :item_id, :null => false
t.string :event, :null => false
t.string :item_type, null: false
t.integer :item_id, null: false
t.string :event, null: false
t.string :whodunnit
t.text :object
t.text :object_changes

View file

@ -2,10 +2,10 @@ class CreateEmailTable < ActiveRecord::Migration
def up
create_table :email_settings do |t|
t.references :conference
t.boolean :send_on_registration, :default => true
t.boolean :send_on_accepted, :default => true
t.boolean :send_on_rejected, :default => true
t.boolean :send_on_confirmed_without_registration, :default => true
t.boolean :send_on_registration, default: true
t.boolean :send_on_accepted, default: true
t.boolean :send_on_rejected, default: true
t.boolean :send_on_confirmed_without_registration, default: true
t.text :registration_email_template
t.text :accepted_email_template
t.text :rejected_email_template

View file

@ -1,6 +1,6 @@
class AddMinimumAndMaximumAbstractLengthsToEventTypes < ActiveRecord::Migration
def change
add_column :event_types, :minimum_abstract_length, :integer, :default => 0
add_column :event_types, :maximum_abstract_length, :integer, :default => 500
add_column :event_types, :minimum_abstract_length, :integer, default: 0
add_column :event_types, :maximum_abstract_length, :integer, default: 500
end
end

View file

@ -1,5 +1,5 @@
class AddDietaryChoiceToConferences < ActiveRecord::Migration
def change
add_column :conferences, :use_dietary_choices, :boolean, :default => false
add_column :conferences, :use_dietary_choices, :boolean, default: false
end
end

View file

@ -2,7 +2,7 @@ class CreateDietaryChoicesTable < ActiveRecord::Migration
def up
create_table :dietary_choices do |t|
t.references :conference
t.string :title, :null => false
t.string :title, null: false
t.timestamps
end
end

View file

@ -1,5 +1,5 @@
class AddHandicappedAccessToRegistrations < ActiveRecord::Migration
def change
add_column :registrations, :handicapped_access_required, :boolean, :default => false
add_column :registrations, :handicapped_access_required, :boolean, default: false
end
end

View file

@ -2,7 +2,7 @@ class CreateSupporterLevelTable < ActiveRecord::Migration
def up
create_table :supporter_levels do |t|
t.references :conference
t.string :title, :null => false
t.string :title, null: false
t.string :url
end
end

View file

@ -7,7 +7,7 @@ class CreateTableSupporterRegistrations < ActiveRecord::Migration
t.string :name
t.string :email
t.string :code
t.boolean :code_is_valid, :default => false
t.boolean :code_is_valid, default: false
end
end

View file

@ -1,5 +1,5 @@
class AddUseSupporterLevelsToConferences < ActiveRecord::Migration
def change
add_column :conferences, :use_supporter_levels, :boolean, :default => false
add_column :conferences, :use_supporter_levels, :boolean, default: false
end
end

View file

@ -1,6 +1,6 @@
class CreateRegistrationsSocialEventsTable < ActiveRecord::Migration
def up
create_table :registrations_social_events, :id => false do |t|
create_table :registrations_social_events, id: false do |t|
t.references :registration, :social_event
end
end

View file

@ -1,6 +1,6 @@
class SetRegistrationDefaultsToFalse < ActiveRecord::Migration
def up
change_column :registrations, :using_affiliated_lodging, :boolean, :default => false
change_column :registrations, :using_affiliated_lodging, :boolean, default: false
end
def down

View file

@ -1,6 +1,6 @@
class CreateEventsRegistrationsTable < ActiveRecord::Migration
def up
create_table :events_registrations, :id => false do |t|
create_table :events_registrations, id: false do |t|
t.references :registration, :event
end
end

View file

@ -1,5 +1,5 @@
class AddAttendedToRegistrations < ActiveRecord::Migration
def change
add_column :registrations, :attended, :boolean, :default => 0
add_column :registrations, :attended, :boolean, default: 0
end
end

View file

@ -1,5 +1,5 @@
class AddScheduleChangesToCallForPapers < ActiveRecord::Migration
def change
add_column :call_for_papers, :schedule_changes, :boolean, :default => 0
add_column :call_for_papers, :schedule_changes, :boolean, default: 0
end
end

View file

@ -1,5 +1,5 @@
class AddRatingToCallForPapers < ActiveRecord::Migration
def change
add_column :call_for_papers, :rating, :integer, :null => 1
add_column :call_for_papers, :rating, :integer, null: 1
end
end

View file

@ -2,7 +2,7 @@ class CreateVpositions < ActiveRecord::Migration
def up
create_table :vpositions do |t|
t.references :conference
t.string :title, :null => false
t.string :title, null: false
t.text :description
t.timestamps

View file

@ -1,9 +1,9 @@
class ChangeDefaultRatingInCallForPapers < ActiveRecord::Migration
def up
change_column :call_for_papers, :rating, :integer, :default => 3
change_column :call_for_papers, :rating, :integer, default: 3
end
def down
change_column :call_for_papers, :rating, :integer, :null => 1
change_column :call_for_papers, :rating, :integer, null: 1
end
end

View file

@ -1,6 +1,6 @@
class RegistrationsVchoices < ActiveRecord::Migration
def up
create_table :registrations_vchoices, :id => false do |t|
create_table :registrations_vchoices, id: false do |t|
t.references :registration, :vchoice
end
end

View file

@ -1,6 +1,6 @@
class CreateConferencesQuestions < ActiveRecord::Migration
def change
create_table :conferences_questions, :id => false do |t|
create_table :conferences_questions, id: false do |t|
t.references :conference
t.references :question
end

View file

@ -1,8 +1,8 @@
class CreateQanswersRegistrations < ActiveRecord::Migration
def change
create_table :qanswers_registrations, :id => false do |t|
t.references :registration, :null => false
t.references :qanswer, :null => false
create_table :qanswers_registrations, id: false do |t|
t.references :registration, null: false
t.references :qanswer, null: false
end
end
end

View file

@ -4,7 +4,7 @@ class CreateDifficultyLevels < ActiveRecord::Migration
t.references :conference
t.string :title
t.text :description
t.string :color, :default => "#ffffff"
t.string :color, default: "#ffffff"
t.timestamps
end

View file

@ -1,5 +1,5 @@
class AddUseDifficultyLevelsToConference < ActiveRecord::Migration
def change
add_column :conferences, :use_difficulty_levels, :boolean, :default => false
add_column :conferences, :use_difficulty_levels, :boolean, default: false
end
end

View file

@ -1,11 +1,11 @@
class UseVdaysVpositionsDefaults < ActiveRecord::Migration
def up
change_column :conferences, :use_vpositions, :boolean, :default => false
change_column :conferences, :use_vdays, :boolean, :default => false
change_column :conferences, :use_vpositions, :boolean, default: false
change_column :conferences, :use_vdays, :boolean, default: false
end
def down
change_column :conferences, :use_vpositions, :boolean, :default => nil
change_column :conferences, :use_vdays, :boolean, :default => nil
change_column :conferences, :use_vpositions, :boolean, default: nil
change_column :conferences, :use_vdays, :boolean, default: nil
end
end

View file

@ -5,22 +5,22 @@
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
Role.create(:name => "Participant")
Role.create(:name => "Organizer")
Role.create(:name => "Admin")
Role.create(name: "Participant")
Role.create(name: "Organizer")
Role.create(name: "Admin")
qtype_yesno = QuestionType.create(:title => "Yes/No")
QuestionType.create(:title => "Single Choice")
QuestionType.create(:title => "Multiple Choice")
qtype_yesno = QuestionType.create(title: "Yes/No")
QuestionType.create(title: "Single Choice")
QuestionType.create(title: "Multiple Choice")
answer_yes = Answer.create(:title => "Yes")
answer_no = Answer.create(:title => "No")
answer_yes = Answer.create(title: "Yes")
answer_no = Answer.create(title: "No")
questions_yes_no = ["Do you need handicapped access to the venue?", "Are you attending with partner?", "Will you attend the social event(s)?", "Will you stay at suggested hotel?"]
questions_yes_no.each do |i|
q = Question.create(:title => i, :question_type_id => qtype_yesno.id, :global => true)
q = Question.create(title: i, question_type_id: qtype_yesno.id, global: true)
Qanswer.create(:question_id => q.id, :answer_id => answer_no.id)
Qanswer.create(:question_id => q.id, :answer_id => answer_yes.id)
Qanswer.create(question_id: q.id, answer_id: answer_no.id)
Qanswer.create(question_id: q.id, answer_id: answer_yes.id)
end

View file

@ -7,7 +7,7 @@ RSpec.configure do |config|
DatabaseCleaner.strategy = :transaction
end
config.before(:each, :js => true) do
config.before(:each, js: true) do
DatabaseCleaner.strategy = :truncation
end

View file

@ -3,7 +3,7 @@ module LoginMacros
Warden.test_mode!
def sign_in(user)
login_as(user, :scope => :user)
login_as(user, scope: :user)
end
def sign_out

View file

@ -5,6 +5,6 @@ describe 'home/index' do
allow(view).to receive(:date_string).and_return("January 17 - 21 2014")
assign(:current, [create(:conference), create(:conference)])
render
expect(view).to render_template(:partial => "_conference_details", :count => 2)
expect(view).to render_template(partial: "_conference_details", count: 2)
end
end