Skip to content

Commit

Permalink
Removed conversion to JSON since the Hash is stored as jsonb
Browse files Browse the repository at this point in the history
  • Loading branch information
mkanoor committed Aug 16, 2017
1 parent ffed7db commit 3e76376
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions app/controllers/api/automate_workspaces_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,11 @@ def show
if obj.nil?
raise NotFoundError, "Invalid Workspace #{@req.c_id} specified"
end
res = {}
res["id"] = obj.id
res["guid"] = obj.guid
res["input"] = JSON.parse(obj.input)
res["output"] = JSON.parse(obj.output) if obj.output

render_resource :automate_workspaces, res
render_resource :automate_workspaces, obj
end

def edit_resource(type, id, data = {})
klass = collection_class(type)
obj = AutomateWorkspace.find_by(:guid => id)
if obj.nil?
raise NotFoundError, "Invalid Workspace #{id} specified"
Expand All @@ -29,8 +23,8 @@ def edit_resource(type, id, data = {})
if workspace.blank? && state_var.blank?
raise BadRequestError, "No workspace or state_var specified for edit"
end
current_output = obj.output ? JSON.parse(obj.output) : {}
obj.output = current_output.deep_merge(data).to_json
current_output = obj.output || {}
obj.output = current_output.deep_merge(data)
obj.save
obj
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/base_controller/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def log_api_auth
log_request("Authentication", :type => auth_type,
:token => request.headers[HttpHeaders::AUTH_TOKEN],
:x_miq_group => request.headers[HttpHeaders::MIQ_GROUP],
:user => User.current_user.try(:userid))
:user => User.current_user.userid)
if User.current_user
group = User.current_user.current_group
log_request("Authorization", :user => User.current_user.userid,
Expand Down

0 comments on commit 3e76376

Please sign in to comment.