mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 04:58:09 +08:00
Perform the where(...).first to find_by(...) refactoring.
This refactoring was automated using the command: bundle exec "ruby refactorings/where_dot_first_to_find_by/app.rb"
This commit is contained in:
@ -6,7 +6,7 @@ class InvitesController < ApplicationController
|
||||
before_filter :ensure_logged_in, only: [:destroy, :create]
|
||||
|
||||
def show
|
||||
invite = Invite.where(invite_key: params[:id]).first
|
||||
invite = Invite.find_by(invite_key: params[:id])
|
||||
|
||||
if invite.present?
|
||||
user = invite.redeem
|
||||
@ -42,7 +42,7 @@ class InvitesController < ApplicationController
|
||||
def destroy
|
||||
params.require(:email)
|
||||
|
||||
invite = Invite.where(invited_by_id: current_user.id, email: params[:email]).first
|
||||
invite = Invite.find_by(invited_by_id: current_user.id, email: params[:email])
|
||||
raise Discourse::InvalidParameters.new(:email) if invite.blank?
|
||||
invite.trash!(current_user)
|
||||
|
||||
|
Reference in New Issue
Block a user