add attr_accessible to blockchain model
This commit is contained in:
parent
55009f2365
commit
3f81a7fa8e
|
@ -1,5 +1,5 @@
|
|||
class Blockchain < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
attr_accessible :id, :project_id, :genesis_content, :network_id, :connect_ip, :port, :enode, :created_at, :updated_at, :user_id
|
||||
has_one :project, :dependent => :destroy
|
||||
|
||||
# 根据项目id查找对应区块链配置信息
|
||||
|
|
|
@ -57,27 +57,22 @@ class RepositoriesService
|
|||
index_split = gitlab_address.index("/")
|
||||
owner_name = gitlab_address[0..index_split - 1]
|
||||
rescue => e
|
||||
Rails.logger.error("error with the repo_url: " + repo_url)
|
||||
Rails.logger.error("!!!!!!!!!!!!error with the repo_url: " + repo_url)
|
||||
return status, nil
|
||||
end
|
||||
|
||||
owner = User.find_by_login(owner_name)
|
||||
if owner
|
||||
Rails.logger.info("!!!!!!!!!!find the owner")
|
||||
projects = Project.find_all_by_user_id(owner.id)
|
||||
if projects.length <= 0
|
||||
return status, nil
|
||||
else
|
||||
Rails.logger.info("!!!!!!!!!!!!!find the owner's projects")
|
||||
projects.each do |project|
|
||||
gpid = project.gpid
|
||||
if gpid
|
||||
Rails.logger.info("!!!!!!!!!!This project has gpid")
|
||||
http_url_to_repo = Gitlab.client.project(gpid).try(:http_url_to_repo)
|
||||
if http_url_to_repo
|
||||
Rails.logger.info("!!!!!!!!!!!find the repo_url for this gpid")
|
||||
if repo_url == http_url_to_repo
|
||||
Rails.logger.info("!!!!!!!!!!!!repo_url equals")
|
||||
status = 0
|
||||
return status, project # 表示找到了
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue