Skip to content

Instantly share code, notes, and snippets.

@arjes
arjes / vash.rb
Created April 6, 2017 01:28 — forked from joshaven/vash.rb
Volatile Ruby Hash > Vash
#############################################################################
# Class: Vash (Ruby Volatile Hash)
# Hash that returns values only for a short time. This is useful as a cache
# where I/O is involved. The primary goal of this object is to reduce I/O
# access and due to the nature of I/O being slower then memory, you should also
# see a gain in quicker response times.
#
# For example, if Person.first found the first person from the database & cache
# was an instance of Vash then the following would only contact the database for
# the first iteration:
@arjes
arjes / ngrxintro.md
Last active February 2, 2017 03:43 — forked from btroncone/ngrxintro.md
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

#Comprehensive Introduction to @ngrx/store By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

Rendered c:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/_trace.erb (2.0ms)
Alarm Load (26240.0ms) SELECT "alarms".* FROM "alarms" ORDER BY event_time desc
Called from: c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.7/lib/active_support/log_subscriber.rb:93:in `call'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.7/lib/active_support/notifications/fanout.rb:47:in `publish'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.7/lib/active_support/notifications/fanout.rb:25:in `block in publish'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.7/lib/active_support/notifications/fanout.rb:25:in `each'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.7/lib/active_support/notifications/fanout.rb:25:in `publish'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.7/lib/active_support/notifications/instrumenter.rb:26:in `instrument'
c:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abs
>> c = Crawler.new
NoMethodError: undefined method `has_key?' for nil:NilClass
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:2801:in `has_attribute?'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:2857:in `inspect'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:2856:in `collect'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:2856:in `inspect'
from /usr/local/lib/ruby/1.8/irb.rb:302:in `output_value'
from /usr/local/lib/ruby/1.8/irb.rb:151:in `eval_input'
from /usr/local/lib/ruby/1.8/irb.rb:263:in `signal_status'
from /usr/local/lib/ruby/1.8/irb.rb:147:in `eval_input'
%h1
I think
=current_user.enemy
is dumb
NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]
from /usr/lib/ruby/gems/1.8/gems/paperclip-2.3.3/lib/paperclip/thumbnail.rb:18:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/paperclip-2.3.3/lib/paperclip/processor.rb:33:in `new'
from /usr/lib/ruby/gems/1.8/gems/paperclip-2.3.3/lib/paperclip/processor.rb:33:in `make'
from /usr/lib/ruby/gems/1.8/gems/paperclip-2.3.3/lib/paperclip/attachment.rb:295:in `post_process_styles'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/whiny_nil.rb:55:in `inject'
from /usr/lib/ruby/gems/1.8/gems/paperclip-2.3.3/lib/paperclip/attachment.rb:294:in `each'
from /usr/lib/ruby/gems/1.8/gems/paperclip-2.3.3/lib/paperclip/attachment.rb:294:in `inject'
def update
@item = Item.find(params[:id])
if @item.update_attributes(params[:item])
flash[:notice] = "Successfully updated item."
redirect_to @item
else
render :action => 'edit'
end
end
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/attribute_methods.rb:260:in `method_missing'
/usr/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.17/lib/thinking_sphinx/attribute.rb:183:in `send'
/usr/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.17/lib/thinking_sphinx/attribute.rb:183:in `live_value'
/usr/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.17/lib/thinking_sphinx/attribute.rb:182:in `each'
/usr/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.17/lib/thinking_sphinx/attribute.rb:182:in `live_value'
/usr/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.17/lib/thinking_sphinx/active_record/attribute_updates.rb:40:in `attribute_values_for_index'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:2036:in `inject'
/usr/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.17/lib/thinking_sphinx/active_record/attribute_updates.rb:39:in `each'
/usr/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.17/lib/thinking_sphinx/active_record/attribute_updates.rb:39:in `inject'
/usr/lib/ruby/gems/1.8/gems/thinking-sp