ActiveAdmin.register JamRuby::Jamblaster, :as => 'Jamblaster' do


  config.filters = false
  menu :label => 'JamBlasters', :parent => 'JamBlaster'

  scope("Connected", default: true) { |scope| scope.where('client_id in (select client_id from connections)') }
  scope("All") { |scope| scope.order('created_at desc') }

  form do |f|
    f.inputs 'New JamBlaster' do
      f.input :user, required: true, collection: User.all, include_blank: false
      f.input :serial_no, required: true
      f.input :client_id, required: false
      f.input :users, required: true, collection: User.all, include_blank: false
    end
    f.actions
  end


  index do

    # actions # use this for all view/edit/delete links

    column 'Serial' do |oo|
      oo.serial_no
    end

    column 'IPv4' do |oo|
      oo.ipv4_link_local
    end

    column 'IPv6' do |oo|
      oo.ipv6_link_local
    end

  end


end
