修改fork_user.json.jbuilder

This commit is contained in:
sylor_huang@126.com 2020-05-15 17:45:44 +08:00
parent e67831df77
commit 84ed5bb06c
3 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@ json.count @fork_users.size
json.fork_users do
json.array! @fork_users.each do |f|
user = f.user
fork_project = Project.select(:id,).find_by(f.fork_project_id)
fork_project = Project.select(:id,:fork_project_id,:name).find_by(id: f.fork_project_id)
json.id f.fork_project_id
json.name "#{user.try(:show_real_name)}/#{fork_project.name}"
json.login user.try(:login)

View File

@ -1,4 +1,4 @@
json.cout @watch_users.size
json.cout @watchers.size
json.watchers do
json.partial! "/projects/list_user", collection: @watch_user, as: :target
json.partial! "/projects/list_user", collection: @watchers, as: :target
end

View File

@ -9,7 +9,7 @@ class CreateForkUsers < ActiveRecord::Migration[5.2]
add_index :fork_users, :project_id
add_index :fork_users, :user_id
projects = Project.where.not(forked_from_project_id: [nil, ""])
projects = Project.where("forked_from_project_id is not null")
projects.each do |p|
ForkUser.create(project_id: p.forked_from_project_id, fork_project_id: p.id, user_id: p.user_id)
end