This is a rough proof of concept.
There will be broken things.
Comments are welcome.
Installation
NoMethodError - undefined method `<<' for nil:NilClass: | |
actionpack (4.0.9) lib/action_view/helpers/text_helper.rb:53:in `concat' | |
() Users/admin/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/bundler/gems/active_admin-242e5282cb58/lib/active_admin/form_builder.rb:7:in `input_wrapping' | |
formtastic (3.0.0) lib/formtastic/inputs/base/stringish.rb:8:in `to_html' | |
formtastic (3.0.0) lib/formtastic/helpers/input_helper.rb:242:in `input' | |
arbre (1.0.2) lib/arbre/rails/forms.rb:30:in `proxy_call_to_form' | |
() Users/admin/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/bundler/gems/active_admin-242e5282cb58/lib/active_admin/views/components/active_admin_form.rb:54:in `input' | |
app/admin/customers/customer.rb:56:in `block (3 levels) in <top (required)>' | |
() Users/admin/.rvm/rubies/ruby-2.1.2/lib/ruby/gems/2.1.0/bundler/gems/active_admin-242e5282cb58/lib/active_admin/views/components/active_admin_form.rb:43:in `block in inputs' |
module ActiveAdmin | |
module Views | |
class ActiveAdminForm | |
class DeprecatedFormBufferSubstitute | |
def initialize(form) | |
@form = form | |
end | |
def << (value) | |
@form.text_node value.html_safe | |
end |
module Jobs | |
class AutoRefill < ::BaseJob | |
def execute | |
logger.tagged('autorefill') do | |
scope_to_process.each do |prepaid| | |
begin | |
RefillService.new(prepaid).save! |
class DeprecatedFormBufferSubstitute | |
def initialize(form) | |
@form = form | |
end | |
def << (value) | |
@form.text_node value.html_safe | |
end | |
end | |
def form_buffers |
# This file extends and overrides parts of the ActiveAdmin DSL and internals | |
# in order to provide support for automatically displaying and editing images, | |
# which in our infrastructure are stored as URLs whose column names end in "img". | |
# Since this file will be reloaded frequently in the development environment, | |
# all operations done at load time (class_eval's, etc.) MUST be idempotent. | |
ActiveAdmin::Views::TableFor.class_eval do | |
def img_column(col_sym=:img, title="Image") | |
column title, sortable: false do |obj| |
This shows one technique for preserving filters on index pages for ActiveAdmin resources, without having to patch the ActiveAdmin core.
It restores any previously-used filters whenever the index page is rendered for a resource, unless the current request is an actual application of new filters. It also properly handles the clear-filters button (via a synchronous Ajax request that happens immediately before the normal filter form processing).
Yes, it's a bit of a hack, but it has worked well for me so far.
require 'net/http' | |
module Net | |
class HTTP | |
def self.enable_debug! | |
raise "You don't want to do this in anything but development mode!" unless Rails.env == 'development' | |
class << self | |
alias_method :__new__, :new | |
def new(*args, &blk) | |
instance = __new__(*args, &blk) | |
instance.set_debug_output($stderr) |
unicorn.rb | |
----------------------------------- | |
application = "jarvis" | |
remote_user = "vagrant" | |
env = ENV["RAILS_ENV"] || "development" | |
RAILS_ROOT = File.join("/home", remote_user, application) | |
worker_processes 8 | |
timeout 30 |
This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.
You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf
using homebrew.