Skip to content

Instantly share code, notes, and snippets.

View craigmartin's full-sized avatar

Craig Martin craigmartin

  • Glee Machine, LLC.
  • Portland OR
View GitHub Profile
@craigmartin
craigmartin / monsoc.rb
Created February 24, 2011 21:53
error I get when running ruby file from sintra app
$ ruby monsoc.rb
New Aws::S3Interface using per_thread-connection mode
/usr/local/rvm/gems/ruby-1.9.2-p136@monsoc/gems/dm-core-1.0.2/lib/dm-core/property_set.rb:161:in `block in initialize': undefined method `name' for nil:NilClass (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.2-p136@monsoc/gems/dm-core-1.0.2/lib/dm-core/property_set.rb:161:in `map'
from /usr/local/rvm/gems/ruby-1.9.2-p136@monsoc/gems/dm-core-1.0.2/lib/dm-core/property_set.rb:161:in `initialize'
from /usr/local/rvm/gems/ruby-1.9.2-p136@monsoc/gems/dm-core-1.0.2/lib/dm-core/associations/many_to_many.rb:23:in `new'
from /usr/local/rvm/gems/ruby-1.9.2-p136@monsoc/gems/dm-core-1.0.2/lib/dm-core/associations/many_to_many.rb:23:in `child_key'
from /usr/local/rvm/gems/ruby-1.9.2-p136@monsoc/gems/dm-core-1.0.2/lib/dm-core.rb:341:in `block in finalize_model'
from /usr/local/rvm/gems/ruby-1.9.2-p136@monsoc/gems/dm-core-1.0.2/lib/dm-core.rb:340:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p136@monsoc/gems/dm-core-1.0.2/lib/dm-core.rb:340:in
@craigmartin
craigmartin / models.rb
Created February 24, 2011 22:12
models file
%w(dm-core dm-timestamps dm-validations dm-aggregates).each {|lib| gem lib, '=1.0.2'}
%w(dm-core dm-timestamps dm-validations dm-aggregates dm-migrations RMagick aws ./config).each { |lib| require lib}
include Magick
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, ENV['DATABASE_URL'] || 'mysql://root:fa1556cm@localhost/monsoc')
configure :development do
enable :logging, :dump_errors, :raise_errors
end
@craigmartin
craigmartin / passenger error
Created March 21, 2011 22:13
/var/log/nginx/error.log
2011/03/19 23:02:34 [emerg] 13804#0: "passenger_default_user" directive is not allowed here in /etc/nginx/sites-enabled/orderfork.com:12
2011/03/19 23:06:37 [emerg] 18627#0: "passenger_default_user" directive is not allowed here in /etc/nginx/sites-enabled/orderfork.com:24
*** Passenger ERROR (ext/common/ApplicationPool/../SpawnManager.h:220):
Could not start the spawn server: /usr/local/rvm/bin: Permission denied (13)
*** Passenger ERROR (ext/common/ApplicationPool/../SpawnManager.h:220):
Could not start the spawn server: /usr/local/rvm/bin: Permission denied (13)
*** Passenger ERROR (ext/common/ApplicationPool/../SpawnManager.h:220):
Could not start the spawn server: /usr/local/rvm/bin: Permission denied (13)
*** Passenger ERROR (ext/common/ApplicationPool/../SpawnManager.h:220):
Could not start the spawn server: /usr/local/rvm/bin: Permission denied (13)
@craigmartin
craigmartin / Backtrace - user.rb
Created March 30, 2011 21:52
Backtrace -- NoMethodError at /user/profile -- file: user.rb location: block in <top (required)> line: 10
user.rb in block in <top (required)>
unless @User.update(:nickname => params[:nickname],
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/sinatra-1.1.3/lib/sinatra/base.rb in call
proc { unbound_method.bind(self).call },
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/sinatra-1.1.3/lib/sinatra/base.rb in block in compile!
proc { unbound_method.bind(self).call },
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/sinatra-1.1.3/lib/sinatra/base.rb in instance_eval
throw :halt, instance_eval(&block)
/usr/local/rvm/gems/ruby-1.9.2-rc2/gems/sinatra-1.1.3/lib/sinatra/base.rb in route_eval
throw :halt, instance_eval(&block)
@craigmartin
craigmartin / user.rb
Created March 30, 2011 21:54
user.rb file for error reference
get "/user/profile" do
haml :profile
end
get "/user/profile/change" do
haml :change_profile
end
post "/user/profile" do
unless @User.update(:nickname => params[:nickname],
@craigmartin
craigmartin / monsoc.rb
Created March 30, 2011 23:38
application file
require 'rubygems'
gem 'rest-client', '=1.6.1'
%w(./config haml sinatra digest/md5 rack-flash json rest-client ./models).each { |lib| require lib}
set :sessions, true
set :show_exceptions, false
set :environment, :development
use Rack::Flash
get "/" do
if session[:userid].nil? then
@craigmartin
craigmartin / new user.rb file
Created March 31, 2011 21:46
change: added unless @user.create
get "/user/profile" do
haml :profile
end
get "/user/profile/change" do
haml :change_profile
end
post "/user/profile" do
unless @user.create(:nickname => params[:nickname],
@craigmartin
craigmartin / newest backtrace
Created April 1, 2011 19:28
thrown from dm-core/model/relationship.rb and dm-core/model/property.rb -- undefined method `update_or_create' for User:Class
NoMethodError at /after_login
undefined method `update_or_create' for User:Class
file: relationship.rb location: method_missing line: 378
BACKTRACE
(condense)
JUMP TO: GET POST COOKIES ENV
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/dm-core-1.1.0/lib/dm-core/model/relationship.rb in method_missing
super
/usr/local/rvm/gems/ruby-1.9.2-p136/gems/dm-core-1.1.0/lib/dm-core/model/property.rb in method_missing
@craigmartin
craigmartin / new models.rb file
Created April 1, 2011 19:47
this is what is throwing the latest backtrace --895391.git
%w(dm-core dm-timestamps dm-validations dm-aggregates).each {|lib| gem lib, '=1.1.0'}
%w(dm-core dm-timestamps dm-validations dm-aggregates dm-migrations RMagick aws ./config).each { |lib| require lib}
include Magick
DataMapper.setup(:default, ENV['DATABASE_URL'] || 'mysql://root:fa1556cm@localhost/monsoc')
S3 = Aws::S3Interface.new(S3_CONFIG['AWS_ACCESS_KEY'], S3_CONFIG['AWS_SECRET_KEY'], {:multi_thread => true, :protocol => 'http', :port => 80} )
module Commentable
def people_who_likes
self.likes.collect { |l| "<a href='/user/#{l.user.nickname}'>#{l.user.formatted_name}</a>" }
@craigmartin
craigmartin / snippet of monsoc.rb (app file)
Created April 1, 2011 20:09
I changed the unless to unless user.update_or_create (no cap, so its calling the instance not the User model right?)
require 'rubygems'
#require 'ruby-debug'; debugger;
gem 'rest-client', '=1.6.1'
%w(./config haml sinatra digest/md5 rack rack-flash json rest-client ./models).each { |lib| require lib}
set :sessions, true
set :show_exceptions, true
set :environment, :development
use Rack::Flash
get "/" do