Sha256: 05d85875c661619e77522d8091fb9395aa0f82ba2e70961b9bfb0e78857bbd00

Contents?: true

Size: 615 Bytes

Versions: 2

Compression:

Stored size: 615 Bytes

Contents

module ChosenTemplate
  module ChoosableTemplateController

    def preview_template
      template = template_model_class.find(params[:id])
      template.update_attributes(template_previewed_at: Time.now)
      respond_with template, params.slice(:location)
    end

    def publish_template
      template = template_model_class.find(params[:id])
      template.update_attributes(template_published_at: Time.now)
      respond_with template, params.slice(:location)
    end

    protected

    def template_model_class
      @template_model_class ||= self.controller_name.classify.constantize
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chosen_template-1.0.0 lib/chosen_template/choosable_template_controller.rb
chosen_template-0.1.0 lib/chosen_template/choosable_template_controller.rb