Module: Scaffolding::AbsolutelyAbstract::CreativeConcepts::ControllerSupport

Extended by:
ActiveSupport::Concern
Included in:
Account::Scaffolding::AbsolutelyAbstract::CreativeConceptsController
Defined in:
app/controllers/concerns/scaffolding/absolutely_abstract/creative_concepts/controller_support.rb

Instance Method Summary collapse

Instance Method Details

#ensure_current_user_can_manage_creative_concept(creative_concept) ⇒ Object



4
5
6
7
8
9
10
# File 'app/controllers/concerns/scaffolding/absolutely_abstract/creative_concepts/controller_support.rb', line 4

def ensure_current_user_can_manage_creative_concept(creative_concept)
  unless can? :manage, creative_concept
    collaborator = creative_concept.collaborators.find_or_create_by(membership: current_membership)
    collaborator.roles << :admin
    collaborator.save
  end
end