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
brew update | |
brew install libyaml openssl | |
rvm get latest | |
rvm install ruby-2.0.0-preview1 --with-openssl-dir=`brew --prefix openssl` |
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
# see https://github.com/rails/rails/pull/6376 | |
# put this in an initializer | |
module NsecCacheKeyPatch | |
# Override ActiveRecord::Integration#cache_key | |
def cache_key | |
case | |
when new_record? |
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 ActionView | |
module Helpers | |
module FormHelper | |
def text_area(object_name, method, options = {}) | |
html = InstanceTag.new(object_name, method, self, options.delete(:object)).to_text_area_tag(options) | |
html.sub(/>\
/, '>').html_safe | |
end | |
end | |
end | |
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
around_destroy { puts "around"; yield } | |
def destroy | |
_run_destroy_callbacks do | |
@destroyed = true | |
freeze | |
end | |
end | |
# refs: |
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
["abc", 123, nil, false].reject &:nil? | |
=> ["abc", 123, false] | |
["abc", 123, nil, false].reject &:! | |
=> ["abc", 123] |
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
# 3.days.wtf :from_now | |
# => ["/Users/tee/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/core_ext/numeric/time.rb", 73] | |
# 3.days.wtf :fromnow | |
# => "fromnow not defined" | |
class Object | |
def wtf(method_name) | |
method(method_name).source_location | |
rescue NameError |
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
# I can understand this | |
if never? | |
use_unless_else | |
else | |
use_if_else | |
end | |
# and this | |
if chewbacca_is_a_wookie? | |
use_if_else |
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
class DeviseResqueMailer < Devise::Mailer | |
include Resque::ModelMailer | |
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
Devise.setup do |config| | |
require 'devise_resque_mailer' | |
config.mailer = 'DeviseResqueMailer' | |
# ... | |
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
gem 'devise' | |
gem 'resque' | |
gem 'resque_mailer' |