Skip to content

Latest commit

 

History

History
65 lines (50 loc) · 1.42 KB

README.md

File metadata and controls

65 lines (50 loc) · 1.42 KB

Active Admin Event log for AA 0.6.0

Info

Active Admin event log

Installation guide

  1. Add gem to gemfile
gem 'active_admin_event_log', :git => "https://github.com/netbrick/active_admin_event_log.git"
  1. Run rails generator for create event log migration and create active_admin template (offcourse you'll be able to modify active admin event log resource after that)
rails generate active_admin_event_log:install
  1. Run migrations
rake db:migrate
  1. Add your translations (you can inspire in config/locales/en.yml)
en:
  activerecord:
    models:
      active_admin_event_log/active_admin_event:
        one: "Event log"
        zero: "Event log"
        other: "Events log"
    attributes:
      active_admin_event_log/active_admin_event:
        created_at: "Created at"
        author: "Source user"
    etc...
  1. Add event log to actions! I didn't find yet automatic way for log actions and batch actions
  member_action :set_payed do
    # Find order to pay
    order = Order.find(params[:id])

    # Set payed
    order.set_payed

    # Create log
    ActiveAdminEventLog.create_event_record(
      "set_payed",
      order,
      current_active_admin_user,
      { "order" => true } # Dirty detector go through order object and looking for changes
    )

    # Save!
    order.save
  end