Skip to content

Commit

Permalink
Override the href_slug method to use GUID instead of id
Browse files Browse the repository at this point in the history
  • Loading branch information
mkanoor committed Oct 5, 2017
1 parent 56745db commit 292ab8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/automate_workspace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ class AutomateWorkspace < ApplicationRecord
validates :tenant, :presence => true
validates :user, :presence => true

def href_slug
Api::Utils.build_href_slug(self.class, guid)
end

def merge_output!(hash)
if hash['objects'].nil? || hash['state_vars'].nil?
raise ArgumentError, "No objects or state_vars specified for edit"
Expand Down
4 changes: 4 additions & 0 deletions spec/models/automate_workspace_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@

expect(aw.output).to eq(merged_hash)
end

it "#href_slug" do
expect(aw.href_slug).to eq("automate_workspaces/#{aw.guid}")
end
end
end

0 comments on commit 292ab8c

Please sign in to comment.