mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Merge pull request #2666 from akshaymohite/optimization-fixes
Fixed ActiveRecord validation for post_id in incoming_link.rb
This commit is contained in:
commit
0d72b670f8
@ -4,7 +4,7 @@ class IncomingLink < ActiveRecord::Base
|
|||||||
belongs_to :incoming_referer
|
belongs_to :incoming_referer
|
||||||
|
|
||||||
validate :referer_valid
|
validate :referer_valid
|
||||||
validate :post_id, presence: true
|
validates :post_id, presence: true
|
||||||
|
|
||||||
after_create :update_link_counts
|
after_create :update_link_counts
|
||||||
|
|
||||||
@ -40,11 +40,11 @@ class IncomingLink < ActiveRecord::Base
|
|||||||
|
|
||||||
unless cid && cid == user_id
|
unless cid && cid == user_id
|
||||||
|
|
||||||
IncomingLink.create(referer: referer,
|
create(referer: referer,
|
||||||
user_id: user_id,
|
user_id: user_id,
|
||||||
post_id: post_id,
|
post_id: post_id,
|
||||||
current_user_id: cid,
|
current_user_id: cid,
|
||||||
ip_address: opts[:ip_address]) if post_id
|
ip_address: opts[:ip_address]) if post_id
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user