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 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! |
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
$ 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' |
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 Contact | |
include DataMapper::Resource | |
property :id, Serial | |
property :email, String | |
has 1, :person | |
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
Merb::Authentication.after_authentication do |user, request, params| | |
user.update_attributes(:logged_in_at => Time.now) | |
user | |
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
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. |
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 Exceptions < Merb::Controller | |
# handle NotFound exceptions (404) | |
def not_found | |
render :format => :html | |
end | |
# handle NotAcceptable exceptions (406) | |
def not_acceptable | |
render :format => :html |
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 Exceptions < Merb::Controller | |
# handle NotFound exceptions (404) | |
def not_found | |
render :format => :html | |
end | |
# handle NotAcceptable exceptions (406) | |
def not_acceptable | |
render :format => :html |
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 Exceptions < Merb::Controller | |
# handle NotFound exceptions (404) | |
def not_found | |
render :format => :html | |
end | |
# handle NotAcceptable exceptions (406) | |
def not_acceptable | |
render :format => :html |
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 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! |
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
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 |