Module: WithSlug

Extended by:
ActiveSupport::Concern
Included in:
Content
Defined in:
app/models/concerns/with_slug.rb

Overview

TODO may use mumukit slug

Instance Method Summary collapse

Instance Method Details

#rebase!(organization) ⇒ Object

Copy and Rebase



17
18
19
# File 'app/models/concerns/with_slug.rb', line 17

def rebase!(organization)
  self.slug = self.slug.to_mumukit_slug.rebase(organization).to_s
end

#rebased_dup(organization) ⇒ Object



21
22
23
# File 'app/models/concerns/with_slug.rb', line 21

def rebased_dup(organization)
  dup.tap { |it| it.rebase! organization }
end

#slug_partsObject



10
11
12
13
# File 'app/models/concerns/with_slug.rb', line 10

def slug_parts
  org, repo = slug.split('/')
  {organization: org, repository: repo}
end