commit_diff json数据转换成OpenStruct类型

This commit is contained in:
daiao 2016-11-28 16:08:04 +08:00
parent ace999e331
commit 3f5e840e76
1 changed files with 1 additions and 3 deletions

View File

@ -581,11 +581,9 @@ update
def commit_diff def commit_diff
# 顶部导航 # 顶部导航
@project_menu_type = 5 @project_menu_type = 5
@commit_diff = @g.commit_diff(@project.gpid, params[:changeset]) @commit_diff = @g.commit_diff(@project.gpid, params[:changeset])
diff = @commit_diff.first diff = ActiveSupport::JSON.decode(@commit_diff.to_json).first
diff = OpenStruct.new(diff) diff = OpenStruct.new(diff)
logger.info("######################{diff}")
@diff_file = Trustie::Gitlab::Diff::File.new(diff) @diff_file = Trustie::Gitlab::Diff::File.new(diff)
# diff_file.diff_lines.each_with_index do |line, index| # diff_file.diff_lines.each_with_index do |line, index|