Skip to content

Instantly share code, notes, and snippets.

View thejonanshow's full-sized avatar

Jonan Scheffler thejonanshow

View GitHub Profile
@thejonanshow
thejonanshow / silent_assets.rb
Created April 23, 2012 14:51 — forked from cstrahan/silent_assets.rb
Silence/squelch/quiet assets in Rails logger
# Place in config/initializers/
Rails.application.assets.logger = Logger.new('/dev/null')
Rails::Rack::Logger.class_eval do
def call_with_quiet_assets(env)
previous_level = Rails.logger.level
Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0
call_without_quiet_assets(env).tap do
Rails.logger.level = previous_level
end
- f.fields_for :integration_store_codes do |builder|
= builder.label :active
= builder.check_box :active
# in the middle of my form I want access to the original object so I can output it's associated store's name
= builder.magically_turns_into_an_integration_store_code.store.name
= builder.label :code
= builder.text_field :code
From the asset model:
def alt_text
attachments.first.alt_text if attachments.first
end
My test:
<% gallery_li_class = defaults[:gallery_li_class] || "" %>
139 <% gallery_li_class << ' first' if defaults[:photos].first? %>
140 <% gallery_li_class << ' last' if defaults[:photos].last? %>
358 desc "Rebuilds the vhost.map or nginx_vhost.map depending on OS, environ +ment, etc."
359 task(:rebuild_vhost_map => :environment) do
360 ClientDomain.rebuild_vhost_map
361 end