Class: ActiveStix::CampaignsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ActiveStix::CampaignsController
- Defined in:
- app/controllers/active_stix/campaigns_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /stix/campaigns POST /stix/campaigns.json.
-
#destroy ⇒ Object
DELETE /stix/campaigns/1 DELETE /stix/campaigns/1.json.
-
#edit ⇒ Object
GET /stix/campaigns/1/edit.
-
#index ⇒ Object
GET /stix/campaigns GET /stix/campaigns.json.
-
#new ⇒ Object
GET /stix/campaigns/new.
-
#show ⇒ Object
GET /stix/campaigns/1 GET /stix/campaigns/1.json.
-
#update ⇒ Object
PATCH/PUT /stix/campaigns/1 PATCH/PUT /stix/campaigns/1.json.
Instance Method Details
#create ⇒ Object
POST /stix/campaigns POST /stix/campaigns.json
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/active_stix/campaigns_controller.rb', line 27 def create @campaign = ActiveStix::Campaign.new(stix_campaign_params) respond_to do |format| if @campaign.save ActiveStix::Relationship.relate(@campaign, @threat_actor, "attributed-to") format.html { redirect_to [@threat_actor, @campaign], notice: 'Campaign was successfully created.' } format.json { render :show, status: :created, location: @campaign } else format.html { render :new } format.json { render json: @campaign.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /stix/campaigns/1 DELETE /stix/campaigns/1.json
58 59 60 61 62 63 64 |
# File 'app/controllers/active_stix/campaigns_controller.rb', line 58 def destroy @campaign.destroy respond_to do |format| format.html { redirect_to stix_campaigns_url, notice: 'Campaign was successfully destroyed.' } format.json { head :no_content } end end |
#edit ⇒ Object
GET /stix/campaigns/1/edit
22 23 |
# File 'app/controllers/active_stix/campaigns_controller.rb', line 22 def edit end |
#index ⇒ Object
GET /stix/campaigns GET /stix/campaigns.json
7 8 9 |
# File 'app/controllers/active_stix/campaigns_controller.rb', line 7 def index @campaigns = ActiveStix::Campaign.all end |
#new ⇒ Object
GET /stix/campaigns/new
17 18 19 |
# File 'app/controllers/active_stix/campaigns_controller.rb', line 17 def new @campaign = ActiveStix::Campaign.new end |
#show ⇒ Object
GET /stix/campaigns/1 GET /stix/campaigns/1.json
13 14 |
# File 'app/controllers/active_stix/campaigns_controller.rb', line 13 def show end |
#update ⇒ Object
PATCH/PUT /stix/campaigns/1 PATCH/PUT /stix/campaigns/1.json
44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/active_stix/campaigns_controller.rb', line 44 def update respond_to do |format| if @campaign.update(stix_campaign_params) format.html { redirect_to @campaign, notice: 'Campaign was successfully updated.' } format.json { render :show, status: :ok, location: @campaign } else format.html { render :edit } format.json { render json: @campaign.errors, status: :unprocessable_entity } end end end |