Sha256: 3bf371d7c12ed076fa9ec46f500b650f1b99215fc5b890c833ffad99830873f0

Contents?: true

Size: 986 Bytes

Versions: 5

Compression:

Stored size: 986 Bytes

Contents

require_dependency "chaskiq/application_controller"

module Chaskiq
  class Manage::TemplatesController < ApplicationController

    before_filter :authentication_method

    def index
      @templates = Chaskiq::Template.all
    end

    def show
      @template =  Chaskiq::Template.find(params[:id])
    end

    def new
      @template =  Chaskiq::Template.new
    end

    def edit
      @template =  Chaskiq::Template.find(params[:id])
    end

    def update
      @template =  Chaskiq::Template.find(params[:id])
      if @template.update_attributes(resource_params)
        redirect_to manage_templates_path
      else
        render "edit"
      end
    end

    def create
      @template =  Chaskiq::Template.create(resource_params)
      if @template.errors.blank?
        redirect_to manage_templates_path
      else
        render "new"
      end
    end

    def resource_params
      return [] if request.get?
      params.require(:template).permit!
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
chaskiq-0.0.6 app/controllers/chaskiq/manage/templates_controller.rb
chaskiq-0.0.5 app/controllers/chaskiq/manage/templates_controller.rb
chaskiq-0.0.4 app/controllers/chaskiq/manage/templates_controller.rb
chaskiq-0.0.3 app/controllers/chaskiq/manage/templates_controller.rb
chaskiq-0.0.2 app/controllers/chaskiq/manage/templates_controller.rb