user.rb: drop unused add_favorite!, delete_favorite! methods.
These methods were incorrect anyway, didn't upvote/downvote the post.
This commit is contained in:
@@ -108,6 +108,7 @@ class User < ApplicationRecord
|
||||
has_many :forum_posts, -> {order("forum_posts.created_at, forum_posts.id")}, :foreign_key => "creator_id"
|
||||
has_many :user_name_change_requests, -> {visible.order("user_name_change_requests.created_at desc")}
|
||||
has_many :favorite_groups, -> {order(name: :asc)}, foreign_key: :creator_id
|
||||
has_many :favorites, ->(rec) {where("user_id % 100 = #{rec.id % 100} and user_id = #{rec.id}").order("id desc")}
|
||||
belongs_to :inviter, class_name: "User", optional: true
|
||||
after_update :create_mod_action
|
||||
accepts_nested_attributes_for :dmail_filter
|
||||
@@ -297,20 +298,6 @@ class User < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
module FavoriteMethods
|
||||
def favorites
|
||||
Favorite.where("user_id % 100 = #{id % 100} and user_id = #{id}").order("id desc")
|
||||
end
|
||||
|
||||
def add_favorite!(post)
|
||||
Favorite.add(post: post, user: self)
|
||||
end
|
||||
|
||||
def remove_favorite!(post)
|
||||
Favorite.remove(post: post, user: self)
|
||||
end
|
||||
end
|
||||
|
||||
module LevelMethods
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
@@ -917,7 +904,6 @@ class User < ApplicationRecord
|
||||
include NameMethods
|
||||
include PasswordMethods
|
||||
include AuthenticationMethods
|
||||
include FavoriteMethods
|
||||
include LevelMethods
|
||||
include EmailMethods
|
||||
include BlacklistMethods
|
||||
|
||||
Reference in New Issue
Block a user