Importing images for models done with missing images for the following 76 models:
- /hyundai/elantra.jpg
- /hyundai/azera.jpg
- /honda/goldwing.jpg
- /nissan/maxima_3.5.jpg
- /saturn/ion.jpg
- /chevrolet/k_1500.jpg
- /chevrolet/c150.jpg
- /chevrolet/express.jpg
namespace :cache do | |
task :clear => :environment do | |
puts "=> Clearning Rails cache..." | |
Rake::Task["cache:stats"].invoke | |
puts "\n `Rails.cache.clear` => " + Rails.cache.clear.to_s + "\n\n" | |
# manually reset the stats, as clearing the cache doesn't do so | |
Rails.cache.dalli.reset_stats if Rails.cache.try(:dalli).respond_to? :reset_stats | |
Rake::Task["cache:stats"].reenable |
Importing images for models done with missing images for the following 76 models:
module Octopus | |
def self.shards_in(group=nil) | |
config[Rails.env].try(:[], group.to_s).try(:keys) | |
end | |
def self.followers | |
shards_in(:followers) | |
end | |
class << self | |
alias_method :followers_in, :shards_in | |
alias_method :slaves_in, :shards_in |
irb(main):001:0> module A
irb(main):002:1> def sound_off
irb(main):003:2> puts 'module a'
irb(main):004:2> end
irb(main):005:1> end
=> nil
irb(main):006:0>
irb(main):007:0* module B
irb(main):008:1> def sound_off
def select2_select(option, opts={}) | |
# same as foundation_select, but for select2 | |
# boxes used throughout the staff app. | |
originating_select_name = opts[:from] | |
originating_select_id = find("select[name='#{originating_select_name}']")['id'] | |
custom_select = find(".select2-container[id$='#{originating_select_id}']") | |
# click dropdown | |
custom_select.find("a.select2-choice").click | |
# click option with correct text |
module ErrorsWithTypesExtensions
attr_reader :types
# Pass in the instance of the object that is using the errors object.
#
# class Person
# def initialize
# @errors = ActiveModel::Errors.new(self)
# end
I love the concept and usability of an ActiveModel::Errors paradigm. However, I and others often find it frustrating to work with the implementation.
I'd love to see a proper ActiveModel::Error
object, where the errors attribute of a model including ActiveModel::Errors was an Enumerator of these objects.
There are various implied benefits and added flexibility that could be introduced in a backwards compatible way later, and immedate benefits.
# Serializing 1 string attribute, 1 overriden uuid.to_s attribute, | |
# and 1 empty array, 30 times. | |
# bmbm: | |
# user system total real | |
# serializer 0.010000 0.000000 0.010000 ( 0.002572) | |
# delegator 0.000000 0.000000 0.000000 ( 0.000424) | |
# ips: | |
# delegator: 3600.6 i/s | |
# serializer: 427.6 i/s - 8.42x slower |
class Test
def foo(value=default_value)
value
end
def default_value
'default'
end