This file contains 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
#!/usr/bin/env ruby | |
# code from ~/.rvm/gems/ree-1.8.7-2010.02@bench/gems/railties-3.0.3/lib/rails/commands/runner.rb | |
# added profiling: http://ruby-prof.rubyforge.org/ | |
require 'optparse' | |
require 'rbconfig' | |
require 'rubygems' | |
require 'ruby-prof' |
This file contains 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
# add this to your ../app/controllers/application_controller.rb | |
class ApplicationController < ActionController::Base | |
before_filter { |c| _admin_prolog(c) } # should be the first one! | |
after_filter { |c| _admin_epilog(c) } # should be the last one! |
This file contains 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
class Product < ActiveRecord::Base | |
has_many :material_product_mappings, :dependent => :destroy, :inverse_of => :product | |
has_many :materials, :through => :material_product_mappings, :autosave => true | |
#... | |
rails_admin do | |
list do | |
field :material_product_mappings do |
This file contains 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
app has 68 models of which 34 are included in rails_admin and are configured via a rails_admin block in their respective model.rb files. | |
the two logs attached show a 4x difference in request processing time with and without using the config/included_models functionality. | |
the first log traces the calls made to rails_admin config as models are loaded (look for ra_config). looks like death by a thousand cuts. |
This file contains 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
#!/usr/bin/env ruby | |
# analyze a .map file and output sizes of each pod, gem, the app itself, RubyMotion, iOS | |
# also output functions (as per the -n option) sorted by size (high to low) | |
# | |
# change *_PREFIX constants and/or path_regexes to fit your specifics | |
# | |
# requires that RubyMotion is patched in order to generate the mapfile: | |
# /Library/RubyMotion2.26/lib/motion/project/builder.rb | |
# |
This file contains 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
# A https://github.com/plataformatec/simple_form puts it's alert box inside of the form instead | |
# of using the flash object. This may look clunky depending on how the various backgrounds are set up on the page. | |
# E.g. in a view, f.error_notification puts the alert within the form instead of above | |
# it where flash info goes as per the layout | |
<%= simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> | |
<%= f.error_notification %> | |
<%= f.full_error :confirmation_token %> | |
<div class="form-inputs"> |