Skip to content

Instantly share code, notes, and snippets.

View TheNicholasNick's full-sized avatar

Nicholas Nick TheNicholasNick

View GitHub Profile
class User < CouchRest::ExtendedDocument
use_database CouchRest.database!(Merb::Config[:couchdb_url] + Merb::Config[:database])
property :email
property :crypted_password
property :salt
save_callback :before, :encrypt_password
timestamps!
$ ruby main.rb
== Sinatra/0.9.1 has taken the stage on 4567 for development with backup from Thin
>> Thin web server (v1.0.0 codename That's What She Said)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:4567, CTRL+C to stop
Errno::ECONNREFUSED - Connection refused - connect(2):
/home/sinatra/ruby/1.8.7-p72/lib/ruby/1.8/net/http.rb:560:in `initialize'
/home/sinatra/ruby/1.8.7-p72/lib/ruby/1.8/net/http.rb:560:in `open'
/home/sinatra/ruby/1.8.7-p72/lib/ruby/1.8/net/http.rb:560:in `connect'
/home/sinatra/ruby/1.8.7-p72/lib/ruby/1.8/timeout.rb:53:in `timeout'
class Contact
include DataMapper::Resource
property :id, Serial
property :email, String
has 1, :person
end
Merb::Authentication.after_authentication do |user, request, params|
user.update_attributes(:logged_in_at => Time.now)
user
end
require 'rubygems'
require 'rake/rdoctask'
require 'merb-core'
require 'merb-core/tasks/merb'
include FileUtils
# Load the basic runtime dependencies; this will include
# any plugins and therefore plugin rake tasks.
class Exceptions < Merb::Controller
# handle NotFound exceptions (404)
def not_found
render :format => :html
end
# handle NotAcceptable exceptions (406)
def not_acceptable
render :format => :html
class Exceptions < Merb::Controller
# handle NotFound exceptions (404)
def not_found
render :format => :html
end
# handle NotAcceptable exceptions (406)
def not_acceptable
render :format => :html
class Exceptions < Merb::Controller
# handle NotFound exceptions (404)
def not_found
render :format => :html
end
# handle NotAcceptable exceptions (406)
def not_acceptable
render :format => :html
class Rfprsn
include DataMapper::Resource
...
def self.imported?
if File.exist?(FILE_IN)
options = {:headers => true,
:header_converters => :symbol}
lines = []
self.all.destroy! # make sure we are empty first!
norr@boxen01 /home/pop/nick/project (master) $ thor merb:gem:install
Beginning transaction
Installing merb-action-args-1.0.8
- Successfully uninstalled merb-action-args-1.0.8.1
Installing merb-assets-1.0.8
- Successfully uninstalled merb-assets-1.0.8.1
Installing merb-cache-1.0.8
- Successfully uninstalled merb-cache-1.0.8.1
Installing merb-helpers-1.0.8
- Successfully uninstalled merb-helpers-1.0.8.1