Convert a lot of :a => b to a: b and bring peace to the world
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 0d0f97cc97..812d5bcdd2 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -217,7 +217,7 @@ class ApplicationController < ActionController::Base
def check_restricted_access
# note current_user is defined in the CurrentUser mixin
if SiteSetting.access_password.present? && cookies[:_access] != SiteSetting.access_password
- redirect_to request_access_path(:return_path => request.fullpath)
+ redirect_to request_access_path(return_path: request.fullpath)
return false
end
end
diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb
index 4cd50ee8c3..29d3600d62 100644
--- a/app/controllers/forums_controller.rb
+++ b/app/controllers/forums_controller.rb
@@ -6,7 +6,7 @@ class ForumsController < ApplicationController
def status
if $shutdown
- render text: 'shutting down', :status => 500
+ render text: 'shutting down', status: 500
else
render text: 'ok'
end
diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb
index 4015dfdb3a..f477852fbe 100644
--- a/app/controllers/topics_controller.rb
+++ b/app/controllers/topics_controller.rb
@@ -20,7 +20,7 @@ class TopicsController < ApplicationController
before_filter :consider_user_for_promotion, only: :show
skip_before_filter :check_xhr, only: [:avatar, :show, :feed]
- caches_action :avatar, :cache_path => Proc.new {|c| "#{c.params[:post_number]}-#{c.params[:topic_id]}" }
+ caches_action :avatar, cache_path: Proc.new {|c| "#{c.params[:post_number]}-#{c.params[:topic_id]}" }
def show
diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb
index efa4872d2f..7b320d0b45 100644
--- a/app/controllers/users/omniauth_callbacks_controller.rb
+++ b/app/controllers/users/omniauth_callbacks_controller.rb
@@ -14,7 +14,7 @@ class Users::OmniauthCallbacksController < ApplicationController
skip_before_filter :check_xhr
# must be done, cause we may trigger a POST
- skip_before_filter :verify_authenticity_token, :only => :complete
+ skip_before_filter :verify_authenticity_token, only: :complete
def complete
# Make sure we support that provider
@@ -49,7 +49,7 @@ class Users::OmniauthCallbacksController < ApplicationController
twitter_screen_name: screen_name
}
- user_info = TwitterUserInfo.where(:twitter_user_id => twitter_user_id).first
+ user_info = TwitterUserInfo.where(twitter_user_id: twitter_user_id).first
@data = {
username: screen_name,
@@ -97,7 +97,7 @@ class Users::OmniauthCallbacksController < ApplicationController
email_valid: true
}
- user_info = FacebookUserInfo.where(:facebook_user_id => fb_uid ).first
+ user_info = FacebookUserInfo.where(facebook_user_id: fb_uid).first
@data = {
username: username,
@@ -194,7 +194,7 @@ class Users::OmniauthCallbacksController < ApplicationController
github_screen_name: screen_name
}
- user_info = GithubUserInfo.where(:github_user_id => github_user_id).first
+ user_info = GithubUserInfo.where(github_user_id: github_user_id).first
@data = {
username: screen_name,
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index b337a95362..41924d5467 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -27,7 +27,7 @@ class UsersController < ApplicationController
end
def update
- user = User.where(:username_lower => params[:username].downcase).first
+ user = User.where(username_lower: params[:username].downcase).first
guardian.ensure_can_edit!(user)
json_result(user) do |u|
@@ -179,7 +179,7 @@ class UsersController < ApplicationController
# Create auth records
if auth.present?
if auth[:twitter_user_id] && auth[:twitter_screen_name] && TwitterUserInfo.find_by_twitter_user_id(auth[:twitter_user_id]).nil?
- TwitterUserInfo.create(:user_id => user.id, :screen_name => auth[:twitter_screen_name], :twitter_user_id => auth[:twitter_user_id])
+ TwitterUserInfo.create(user_id: user.id, screen_name: auth[:twitter_screen_name], twitter_user_id: auth[:twitter_user_id])
end
if auth[:facebook].present? && FacebookUserInfo.find_by_facebook_user_id(auth[:facebook][:facebook_user_id]).nil?
@@ -187,7 +187,7 @@ class UsersController < ApplicationController
end
if auth[:github_user_id] && auth[:github_screen_name] && GithubUserInfo.find_by_github_user_id(auth[:github_user_id]).nil?
- GithubUserInfo.create(:user_id => user.id, :screen_name => auth[:github_screen_name], :github_user_id => auth[:github_user_id])
+ GithubUserInfo.create(user_id: user.id, screen_name: auth[:github_screen_name], github_user_id: auth[:github_user_id])
end
end
@@ -219,7 +219,7 @@ class UsersController < ApplicationController
# TEMP to catch all missing spots
# raise ActiveRecord::RecordNotFound
- user = User.select(:email).where(:username_lower => params[:username].downcase).first
+ user = User.select(:email).where(username_lower: params[:username].downcase).first
if user
# for now we only support gravatar in square (redirect cached for a day), later we can use x-sendfile and/or a cdn to serve local
size = params[:size].to_i
diff --git a/app/helpers/common_helper.rb b/app/helpers/common_helper.rb
index 83ee98efa5..8a1efe4271 100644
--- a/app/helpers/common_helper.rb
+++ b/app/helpers/common_helper.rb
@@ -1,7 +1,7 @@
module CommonHelper
def render_google_analytics_code
if Rails.env == "production" && SiteSetting.ga_tracking_code.present?
- render :partial => "common/google_analytics"
+ render partial: "common/google_analytics"
end
end
-end
\ No newline at end of file
+end
diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rb
index 4a1bc1de90..25f37ae645 100644
--- a/app/mailers/user_notifications.rb
+++ b/app/mailers/user_notifications.rb
@@ -53,8 +53,8 @@ class UserNotifications < ActionMailer::Base
mail to: user.email,
from: "#{I18n.t('user_notifications.digest.from', site_name: SiteSetting.title)} <#{SiteSetting.notification_email}>",
subject: I18n.t('user_notifications.digest.subject_template',
- :site_name => @site_name,
- :date => I18n.l(Time.now, format: :short))
+ site_name: @site_name,
+ date: I18n.l(Time.now, format: :short))
end
end
diff --git a/app/models/category_list.rb b/app/models/category_list.rb
index 255f52d16f..60ff863deb 100644
--- a/app/models/category_list.rb
+++ b/app/models/category_list.rb
@@ -5,7 +5,7 @@ class CategoryList
def initialize(current_user)
@categories = Category
- .includes(:featured_topics => [:category])
+ .includes(featured_topics: [:category])
.includes(:featured_users)
.order('topics_week desc, topics_month desc, topics_year desc')
.to_a
diff --git a/app/models/user_action.rb b/app/models/user_action.rb
index b7d6363a53..283e22bed2 100644
--- a/app/models/user_action.rb
+++ b/app/models/user_action.rb
@@ -1,7 +1,7 @@
class UserAction < ActiveRecord::Base
belongs_to :user
- belongs_to :target_post, :class_name => "Post"
- belongs_to :target_topic, :class_name => "Topic"
+ belongs_to :target_post, class_name: "Post"
+ belongs_to :target_topic, class_name: "Topic"
attr_accessible :acting_user_id, :action_type, :target_topic_id, :target_post_id, :target_user_id, :user_id
validates_presence_of :action_type
[... diff too long, it was truncated ...]
GitHub sha: 5dfb04e4