Skip to content

Instantly share code, notes, and snippets.

PING 10.0.1.1 (10.0.1.1): 56 data bytes
64 bytes from 10.0.1.1: icmp_seq=0 ttl=255 time=77.900 ms
64 bytes from 10.0.1.1: icmp_seq=1 ttl=255 time=65.604 ms
64 bytes from 10.0.1.1: icmp_seq=2 ttl=255 time=1.896 ms
64 bytes from 10.0.1.1: icmp_seq=3 ttl=255 time=183.245 ms
64 bytes from 10.0.1.1: icmp_seq=4 ttl=255 time=93.669 ms
Request timeout for icmp_seq 5
64 bytes from 10.0.1.1: icmp_seq=5 ttl=255 time=1064.093 ms
64 bytes from 10.0.1.1: icmp_seq=6 ttl=255 time=803.661 ms
64 bytes from 10.0.1.1: icmp_seq=7 ttl=255 time=742.282 ms
App.Person = DS.Model.extend(
name: DS.attr("string")
)
I, [2014-01-22T00:26:21.319610 #6253] INFO -- : [2014-01-22 00:26:21 -0800] - *** Waiting for YardiRentCafe events ***
I, [2014-01-22T00:39:46.833059 #6253] INFO -- : [2014-01-22 00:39:46 -0800] - *** Request for YardiRentCafe received ***
I, [2014-01-22T00:39:46.833164 #6253] INFO -- : [2014-01-22 00:39:46 -0800] - *** Syncing inventory for integration store code : 103 ***
F, [2014-01-23T03:13:06.511989 #6253] FATAL -- : Pusher : error : {"code"=>4200, "message"=>"Please reconnect immediately"}

In my code, I put a begin-rescue block to capture errors when Array(decorated) throws an error during a spec run. Note: @current_site is the one in this example, but it also happens with other objects from here on, if I let the specs run.

2.0.0 (#<Admin::Site::SitesController:0x007fb2dd58d6e8>):0 > @current_site.class
=> SiteDecorator < ApplicationDecorator
2.0.0 (#<Admin::Site::SitesController:0x007fb2dd58d6e8>):0 > Array(@current_site)
NoMethodError: undefined method `to_a' for #<Site:0x007fb2dd5dbf50>
from /Users/ramon/.rvm/gems/ruby-2.0.0-p353/gems/activemodel-4.0.2/lib/active_model/attribute_methods.rb:439:in `method_missing'

Based on the error and its backtrace, it seems that the decorator responds_to to_a but when it finally reaches the object, it blows up. If I open a separate Rails console, and I try to replicate this issue, I am unable to do so. I have a feeling that something is making all future decorated objects

[
"/Users/ramon/.rvm/gems/ruby-2.1.0/gems/activemodel-4.0.2/lib/active_model/attribute_methods.rb:439:in `method_missing'",
"/Users/ramon/.rvm/gems/ruby-2.1.0/gems/activerecord-4.0.2/lib/active_record/attribute_methods.rb:155:in `method_missing'",
"/Users/ramon/.rvm/gems/ruby-2.1.0/gems/draper-1.3.0/lib/draper/delegation.rb:10:in `to_a'",
"/Users/ramon/src/unstilted/lib/site_context_methods.rb:13:in `Array'",
"/Users/ramon/src/unstilted/lib/site_context_methods.rb:13:in `current_site'",
"/Users/ramon/src/unstilted/lib/site_context_methods.rb:28:in `switch_schema_to_current_site'",
"/Users/ramon/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:437:in `_run__2117217585860489243__process_action__callbacks'",
"/Users/ramon/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:80:in `run_callbacks'",
"/Users/ramon/.rvm/gems/ruby-2.1.0/gems/actionpack-4.0.2/lib/abstract_controller/callbacks.rb:17:in `process_action'",
@ramontayag
ramontayag / create_directory.md
Last active December 24, 2015 01:29
Administering the Raspberry Pi

From your terminal:

ssh [email protected]

The password is raspberry.

Your want to create the directory in /media/storage:

sudo mkdir /media/storage/directoryname
module Piglatin
def add_ay(word)
word + "ay"
end
end
@ramontayag
ramontayag / gist:6308461
Last active June 10, 2016 10:51
Raspberry Pi setup with BitTorrent Sync

First boot

  • Expand storage
  • Start desktop
  • Reboot

Continue by plugging the LAN cable, then in the router admin panel, find the IP address of the pi. Connect:

ssh pi@ipaddress
App.ScoutsNewController = Ember.ObjectController.extend
submit: ->
model = @get('model')
model.on 'didCreate', ->
console.log 'CREATED' # I want to redirect to the index after creation
model.save()