Sha256: b35bca720130f3213bbac265cf4b2fbc9cdff183d7a4b9ecb9898deafbfe55fb
Contents?: true
Size: 1.21 KB
Versions: 17
Compression:
Stored size: 1.21 KB
Contents
class CampaignsController < ApplicationController before_action :set_campaign, only: [:show, :edit, :update, :destroy] # GET /campaigns def index @campaigns = Campaign.all end # GET /campaigns/1 def show end # GET /campaigns/new def new @campaign = Campaign.new end # GET /campaigns/1/edit def edit end # POST /campaigns def create @campaign = Campaign.new(campaign_params) if @campaign.save redirect_to @campaign, notice: 'Campaign was successfully created.' else render :new end end # PATCH/PUT /campaigns/1 def update if @campaign.update(campaign_params) redirect_to @campaign, notice: 'Campaign was successfully updated.' else render :edit end end # DELETE /campaigns/1 def destroy @campaign.destroy redirect_to campaigns_url, notice: 'Campaign was successfully destroyed.' end private # Use callbacks to share common setup or constraints between actions. def set_campaign @campaign = Campaign.find(params[:id]) end # Only allow a trusted parameter "white list" through. def campaign_params params.require(:campaign).permit(:name, :advertiser_id, :description, :weight) end end
Version data entries
17 entries across 17 versions & 1 rubygems