Skip to content

Commit

Permalink
Convert everything to Ruby 1.9 hash syntax
Browse files Browse the repository at this point in the history
Done automatically with `rubocop --only HashSyntax --auto-correct`
  • Loading branch information
tjgrathwell committed Dec 18, 2015
1 parent 7db15fc commit b2274b7
Show file tree
Hide file tree
Showing 35 changed files with 262 additions and 262 deletions.
4 changes: 2 additions & 2 deletions app/controllers/checkins_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class CheckinsController < ApplicationController

def index
@rsvp_sessions = @session.rsvp_sessions.joins(
:rsvp => :bridgetroll_user
).includes([:rsvp => :user]).order('users.first_name asc, users.last_name asc, users.email asc')
rsvp: :bridgetroll_user
).includes([rsvp: :user]).order('users.first_name asc, users.last_name asc, users.email asc')
respond_to do |format|
format.html { @checkin_counts = @event.checkin_counts }
format.json { render json: @rsvp_sessions }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def update
if successfully_updated
set_flash_message :notice, :updated
# Sign in the user bypassing validation in case his password changed
sign_in @user, :bypass => true
sign_in @user, bypass: true
redirect_to after_update_path_for(@user)
else
render "edit"
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/locations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class LocationsController < ApplicationController
before_action :authenticate_user!, :except => [:show, :index]
before_action :assign_location, :only => [:show, :edit, :update, :destroy]
before_action :authenticate_user!, except: [:show, :index]
before_action :assign_location, only: [:show, :edit, :update, :destroy]

def index
@locations = Location.all
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/regions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class RegionsController < ApplicationController
before_action :authenticate_user!, :except => [:show, :index]
before_action :assign_region, :only => [:show, :edit, :update, :destroy]
before_action :authenticate_user!, except: [:show, :index]
before_action :assign_region, only: [:show, :edit, :update, :destroy]
before_action :validate_region_leader!, only: [:edit, :update]

def index
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/rsvps_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def assign_event
end

def signup_for_new_region?
regions = Region.joins(:locations => :events).where('events.id IN (?)', current_user.events.map(&:id)).distinct
regions = Region.joins(locations: :events).where('events.id IN (?)', current_user.events.map(&:id)).distinct
if regions.length > 0
!regions.include?(@event.region)
else
Expand Down
28 changes: 14 additions & 14 deletions app/helpers/events_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,26 @@ def organizer_list
end

def formatted_event_date(event)
l event.date_in_time_zone(:starts_at), :format => :date_as_day_mdy
l event.date_in_time_zone(:starts_at), format: :date_as_day_mdy
end

def formatted_session_date(event_session)
l event_session.date_in_time_zone(:starts_at), :format => :date_as_day_mdy
l event_session.date_in_time_zone(:starts_at), format: :date_as_day_mdy
end

def formatted_session_time(event_session, start_or_end)
l event_session.date_in_time_zone(start_or_end), :format => :time_as_hm_ampm
l event_session.date_in_time_zone(start_or_end), format: :time_as_hm_ampm
end

def formatted_session_fancy_date(event_session)
fancy_date = l event_session.date_in_time_zone(:starts_at), :format => :date_as_day_month_day_year
fancy_date = l event_session.date_in_time_zone(:starts_at), format: :date_as_day_month_day_year
"#{fancy_date}: #{event_session.name}"
end

def formatted_session_timerange(event_session)
start_time = l event_session.date_in_time_zone(:starts_at), :format => :time_as_hm_ampm_no_zone
end_time = l event_session.date_in_time_zone(:ends_at), :format => :time_as_hm_ampm_no_zone
zone = l event_session.date_in_time_zone(:starts_at), :format => :time_zone
start_time = l event_session.date_in_time_zone(:starts_at), format: :time_as_hm_ampm_no_zone
end_time = l event_session.date_in_time_zone(:ends_at), format: :time_as_hm_ampm_no_zone
zone = l event_session.date_in_time_zone(:starts_at), format: :time_zone
"#{start_time} - #{end_time} #{zone}"
end

Expand All @@ -60,7 +60,7 @@ def formatted_session_datetime(event_session)
def simple_format_with_html(string)
simple_format(
Sanitize.clean(string, Sanitize::Config::RELAXED),
:sanitize => false
sanitize: false
).gsub(%r{(</h\d>|</li>|<ul>|<li>)\s*<br\s*/>}, '\1').html_safe # remove unsightly </h2>\n<br/> combos
end

Expand All @@ -80,20 +80,20 @@ def formatted_event_date_range(event)
if first_date.year == last_date.year
if first_date.month == last_date.month
t :range_as_month_dayrange_year,
:month => l(first_date, format: :date_as_m),
month: l(first_date, format: :date_as_m),
first_day: first_date.day,
last_day: last_date.day,
year: first_date.year
else
t :range_as_monthrange_year,
:first_month_day => l(first_date, format: :date_as_m_d),
:last_month_day => l(last_date, format: :date_as_m_d),
:year => first_date.year
first_month_day: l(first_date, format: :date_as_m_d),
last_month_day: l(last_date, format: :date_as_m_d),
year: first_date.year
end
else
t :range_as_yearrange,
:first_date => l(first_date, format: :date_as_m_d_y),
:last_date => l(last_date, format: :date_as_m_d_y)
first_date: l(first_date, format: :date_as_m_d_y),
last_date: l(last_date, format: :date_as_m_d_y)
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/event_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class EventSession < ActiveRecord::Base

belongs_to :event, inverse_of: :event_sessions
has_many :rsvp_sessions, dependent: :destroy
has_many :rsvps, :through => :rsvp_sessions
has_many :rsvps, through: :rsvp_sessions

after_save :update_event_times
after_destroy :update_event_times
Expand Down
4 changes: 2 additions & 2 deletions app/models/rsvp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ class Rsvp < ActiveRecord::Base
with_options(unless: :historical?) do |normal_event|
normal_event.with_options(if: :role_volunteer?) do |for_volunteers|
for_volunteers.validates_presence_of :subject_experience
for_volunteers.validates_length_of :subject_experience, :in => 10..MAX_EXPERIENCE_LENGTH
for_volunteers.validates_length_of :subject_experience, in: 10..MAX_EXPERIENCE_LENGTH
end

normal_event.with_options(if: :teaching_or_taing?) do |for_teachers|
for_teachers.validates_presence_of :class_level
for_teachers.validates_inclusion_of :class_level, in: (0..5), allow_blank: true
for_teachers.validates_presence_of :teaching_experience
for_teachers.validates_length_of :teaching_experience, :in => 10..MAX_EXPERIENCE_LENGTH
for_teachers.validates_length_of :teaching_experience, in: 10..MAX_EXPERIENCE_LENGTH
end

normal_event.with_options(if: :role_student?) do |for_students|
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Application < Rails::Application
config.active_record.raise_in_transactional_callbacks = true

# set default from address across
ActionMailer::Base.default :from => 'Bridge Troll <troll@railsbridge.org>'
ActionMailer::Base.default from: 'Bridge Troll <troll@railsbridge.org>'

# Devise emails use our layout
config.to_prepare do
Expand Down
4 changes: 2 additions & 2 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@

# Send to local mailserver for viewing mail with mailcatcher
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }
config.action_mailer.smtp_settings = { address: "localhost", port: 1025 }
config.action_mailer.preview_path = "#{Rails.root}/spec/mailers/previews"

# Setup default url options for your specific environment.
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.default_url_options = { host: 'localhost:3000' }

config.after_initialize do
Bullet.enable = ENV['BULLET_ENABLE']
Expand Down
14 changes: 7 additions & 7 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@
config.active_support.deprecation = :notify

config.action_mailer.smtp_settings = {
:address => 'smtp.sendgrid.net',
:port => '587',
:authentication => :plain,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => 'heroku.com'
address: 'smtp.sendgrid.net',
port: '587',
authentication: :plain,
user_name: ENV['SENDGRID_USERNAME'],
password: ENV['SENDGRID_PASSWORD'],
domain: 'heroku.com'
}
config.action_mailer.delivery_method ||= :smtp

config.action_mailer.default_url_options = { :host => ENV['HOST_URL'] }
config.action_mailer.default_url_options = { host: ENV['HOST_URL'] }

# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
Expand Down
2 changes: 1 addition & 1 deletion config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.default_url_options = { host: 'localhost:3000' }

Rails.application.routes.default_url_options[:host] = 'localhost:3000'

Expand Down
Loading

0 comments on commit b2274b7

Please sign in to comment.