gitcoinco/code_fund_ads

View on GitHub
app/controllers/creative_previews_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage
class CreativePreviewsController < ApplicationController
  before_action :authenticate_user!
  before_action :set_creative
  layout false

  private

  def set_creative
    @creative = if authorized_user.can_admin_system?
      Creative.find(params[:creative_id])
    else
      Current.organization&.creatives&.find(params[:creative_id])
    end
  end
end