diff options
author | MrYummy <elemental428@gmail.com> | 2017-06-02 19:17:35 +0200 |
---|---|---|
committer | MrYummy <elemental428@gmail.com> | 2017-06-18 13:11:36 -0400 |
commit | deba1b76e39c3528ca66e92c94a91eb3a8b4526b (patch) | |
tree | ec8a3431f4b2e4793f5aad5c21c2b5c4b1836be2 | |
parent | e2a16f3ae6e4c557a986d6170c1a7420e0ca08e0 (diff) |
Updated find_by methods
-rw-r--r-- | app/models/badge.rb | 4 | ||||
-rw-r--r-- | app/models/comment.rb | 2 | ||||
-rw-r--r-- | app/models/info.rb | 2 | ||||
-rw-r--r-- | app/models/label.rb | 2 | ||||
-rw-r--r-- | app/models/register_token.rb | 2 | ||||
-rw-r--r-- | app/models/role.rb | 8 | ||||
-rw-r--r-- | 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 |