From deba1b76e39c3528ca66e92c94a91eb3a8b4526b Mon Sep 17 00:00:00 2001 From: MrYummy Date: Fri, 2 Jun 2017 19:17:35 +0200 Subject: Updated find_by methods --- app/models/badge.rb | 4 ++-- app/models/comment.rb | 2 +- app/models/info.rb | 2 +- app/models/label.rb | 2 +- app/models/register_token.rb | 2 +- app/models/role.rb | 8 ++++---- app/models/threadreply.rb | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/models/badge.rb b/app/models/badge.rb index a7ff831..ee3de34 100644 --- a/app/models/badge.rb +++ b/app/models/badge.rb @@ -4,9 +4,9 @@ class Badge < ActiveRecord::Base def self.get (input) if input.is_a?(String) || input.is_a?(Symbol) - Badge.find_by_name(input) + Badge.find_by(name: input) elsif input.is_a?(Fixnum) - Badge.find_by_id(input) + Badge.find_by(id: input) elsif input.is_a?(Badge) return input end diff --git a/app/models/comment.rb b/app/models/comment.rb index 35a9a60..951d684 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -61,4 +61,4 @@ class Comment < ActiveRecord::Base background_mailer(mails) end -end \ No newline at end of file +end diff --git a/app/models/info.rb b/app/models/info.rb index b900ad0..cbfa1d3 100644 --- a/app/models/info.rb +++ b/app/models/info.rb @@ -11,4 +11,4 @@ class Info < ActiveRecord::Base [id, to_s.parameterize].join("-") end -end \ No newline at end of file +end diff --git a/app/models/label.rb b/app/models/label.rb index ee2fb56..d7cdc30 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -23,4 +23,4 @@ class Label < ActiveRecord::Base end end end -end \ No newline at end of file +end diff --git a/app/models/register_token.rb b/app/models/register_token.rb index 36c0cd1..5b956ff 100644 --- a/app/models/register_token.rb +++ b/app/models/register_token.rb @@ -1,2 +1,2 @@ class RegisterToken < ActiveRecord::Base -end \ No newline at end of file +end diff --git a/app/models/role.rb b/app/models/role.rb index e780b8c..5e5efa5 100644 --- a/app/models/role.rb +++ b/app/models/role.rb @@ -14,14 +14,14 @@ class Role < ActiveRecord::Base end def is? (name) - !!(Role.find_by_name(name) == self) + !!(Role.find_by(name: name) == self) end def self.get (input) if input.is_a?(String) || input.is_a?(Symbol) - Role.find_by_name(input) + Role.find_by(name: input) elsif input.is_a?(Fixnum) - Role.find_by_id(input) + Role.find_by(id: input) elsif input.is_a?(Role) return input end @@ -31,7 +31,7 @@ class Role < ActiveRecord::Base if role.is_a?(Role) self.value - role.value elsif role.is_a?(Symbol) - self <=> Role.find_by_name(role) + self <=> Role.find_by(name: role) else self.to_i <=> role end diff --git a/app/models/threadreply.rb b/app/models/threadreply.rb index 47b0d97..f285073 100644 --- a/app/models/threadreply.rb +++ b/app/models/threadreply.rb @@ -64,4 +64,4 @@ class Threadreply < ActiveRecord::Base end background_mailer(mails) end -end \ No newline at end of file +end -- cgit v1.2.3