Method: GoodData::MdObject#save_as
- Defined in:
- lib/gooddata/models/metadata.rb
#save_as(new_title = nil) ⇒ GoodData::MdObject
Saves an object with a different name
265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/gooddata/models/metadata.rb', line 265 def save_as(new_title = nil) new_title = "Clone of #{title}" if new_title.nil? # rubocop:disable Security/MarshalLoad dupped = Marshal.load(Marshal.dump(json)) # rubocop:enable Security/MarshalLoad dupped[root_key]['meta'].delete('uri') dupped[root_key]['meta'].delete('identifier') dupped[root_key]['meta']['title'] = new_title x = client.create(self.class, dupped, :project => project) x.save end |