Sha256: 2d5425beff10fabd5a46607c18251afbe86115b96af444b709e7c356658d20fa

Contents?: true

Size: 689 Bytes

Versions: 21

Compression:

Stored size: 689 Bytes

Contents

class WidgetsController < ApplicationController

  def paper_trail_enabled_for_controller
    request.user_agent != 'Disable User-Agent'
  end

  def create
    if PaperTrail.active_record_protected_attributes?
      @widget = Widget.create params[:widget]
    else
      @widget = Widget.create params[:widget].permit!
    end
    head :ok
  end

  def update
    @widget = Widget.find params[:id]
    if PaperTrail.active_record_protected_attributes?
      @widget.update_attributes params[:widget]
    else
      @widget.update_attributes params[:widget].permit!
    end
    head :ok
  end

  def destroy
    @widget = Widget.find params[:id]
    @widget.destroy
    head :ok
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
paper_trail-3.0.0.beta1 test/dummy/app/controllers/widgets_controller.rb