This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ActiveAdmin | |
| module Filters | |
| # This form builder defines methods to build filter forms such | |
| # as the one found in the sidebar of the index page of a standard resource. | |
| class FormBuilder < ::ActiveAdmin::FormBuilder | |
| include ::ActiveAdmin::Filters::FormtasticAddons | |
| def initialize(*args) | |
| @use_form_buffer = true # force ActiveAdmin::FormBuilder to use the form buffer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| &ActiveAdmin.application.namespace(:root).resources["Not Found"].get_page_presenter('index').block |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ActiveAdminHelper | |
| def admin_arbre_context | |
| @admin_arbre_context ||= Arbre::Context.new(assigns, self) | |
| end | |
| def default_renderer | |
| case controller.send(:resource_class).name | |
| when "ActiveAdmin::Page" | |
| "page" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'nokogiri' | |
| RSpec::Matchers.define :have_xml do |xpath, text| | |
| match do |body| | |
| doc = Nokogiri::XML::Document.parse(body) | |
| nodes = doc.xpath(xpath) | |
| nodes.empty?.should be_false | |
| if text | |
| nodes.each do |node| | |
| node.content.should == text | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module EmailExceptionNotification | |
| def self.included(base) | |
| base.rescue_from StandardError, :with => :handle_exceptions | |
| end | |
| def handle_exceptions(e) | |
| deliver_exception(e) | |
| raise e | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Base class | |
| class DynamicHostMailer < ActionMailer::Base | |
| def initialize method_name=nil, host, *args | |
| @host = host | |
| super method_name, *args | |
| end | |
| def url_options | |
| # Host should be checked against a relevant whitelist, this is only an example | |
| { host: @host } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # version 1 | |
| require 'clockwork' | |
| require './config/boot' | |
| require './config/environment' | |
| module DBBackedClockwork | |
| extend Clockwork | |
| # add a periodic job to update @@events |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'torquebox-stomp' | |
| class SomeStomplet | |
| def initialize() | |
| @pending_subscribers = {} | |
| @subscribers = {} | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'torquebox-stomp' | |
| class SomeStomplet | |
| def initialize() | |
| @pending_subscribers = {} | |
| @subscribers = {} | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'torquebox-stomp' | |
| class DemoStomplet | |
| def initialize() | |
| super | |
| @subscribers = [] | |
| # passthrough for local messages to skip auth | |
| @passthrough_code = "e32f53ac7569ae3a1f692177" | |
| end |