Sha256: 1f07f4f7c06601c0f4dba72b6d97e500083079c7ecd9fe8cbd4644431036e3ae

Contents?: true

Size: 646 Bytes

Versions: 9

Compression:

Stored size: 646 Bytes

Contents

class LoldesignPublisher::ActivablesController < LoldesignPublisher::PublisherController
  respond_to :html, :json

  before_filter :load_resource

  def create
    if @resource.update_attribute(:active, true)
      render json: {message: "#{@resource.class.to_s} - #{@resource.id} activated."}
    else
      head :error
    end
  end

  def destroy
    if @resource.update_attribute(:active, false)
      render json: {message: "#{@resource.class.to_s} - #{@resource.id} inactivated."}
    else
      head :error
    end
  end

  private
  def load_resource
    @resource = params[:resource_name].classify.constantize.find params[:id]
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
loldesign_publisher-1.5.0 app/controllers/loldesign_publisher/activables_controller.rb
loldesign_publisher-1.4.0 app/controllers/loldesign_publisher/activables_controller.rb
loldesign_publisher-1.3.6 app/controllers/loldesign_publisher/activables_controller.rb
loldesign_publisher-1.3.4 app/controllers/loldesign_publisher/activables_controller.rb
loldesign_publisher-1.3.3 app/controllers/loldesign_publisher/activables_controller.rb
loldesign_publisher-1.3.2 app/controllers/loldesign_publisher/activables_controller.rb
loldesign_publisher-1.3.1 app/controllers/loldesign_publisher/activables_controller.rb
loldesign_publisher-1.3.0 app/controllers/loldesign_publisher/activables_controller.rb
loldesign_publisher-1.1.0 app/controllers/loldesign_publisher/activables_controller.rb