diff --git a/app/controllers/hack_user_lastest_codes_controller.rb b/app/controllers/hack_user_lastest_codes_controller.rb index afa58290c..08ca3ff77 100644 --- a/app/controllers/hack_user_lastest_codes_controller.rb +++ b/app/controllers/hack_user_lastest_codes_controller.rb @@ -61,7 +61,7 @@ class HackUserLastestCodesController < ApplicationController # 提交记录 def submit_records - records = @my_hack.hack_user_code + records = @my_hack.hack_user_codes @records_count = records.count @records = paginate records.created_order diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index df9bab36a..f93b2dab5 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -134,7 +134,7 @@ class HacksController < ApplicationController begin base_attrs = { user_id: @hack.user_id, viewed: 0, tiding_type: 'System', trigger_user_id: current_user.id, - parent_container_type: "HackDelete" + parent_container_type: "HackDelete", extra: "#{@hack.name}" } @hack.tidings.create!(base_attrs) @hack.destroy diff --git a/app/decorators/tiding_decorator.rb b/app/decorators/tiding_decorator.rb index a9f60b890..8e0c402dd 100644 --- a/app/decorators/tiding_decorator.rb +++ b/app/decorators/tiding_decorator.rb @@ -412,6 +412,6 @@ module TidingDecorator end def hack_content - I18n.t(locale_format(parent_container_type)) % container&.name + I18n.t(locale_format(parent_container_type)) % (container&.name || extra) end end diff --git a/app/models/hack.rb b/app/models/hack.rb index b94eddbd2..37e1f239d 100644 --- a/app/models/hack.rb +++ b/app/models/hack.rb @@ -14,7 +14,7 @@ class Hack < ApplicationRecord # 点赞 has_many :praise_treads, as: :praise_tread_object, dependent: :destroy # 消息 - has_many :tidings, as: :container, dependent: :destroy + has_many :tidings, as: :container belongs_to :user