My Recent Pastes (10 and counting)

Recent Pasties by antares (10 and counting)

Below are summaries of the 10 most recent pasties by antares.

May 22, 2008
6:34PM EDT
by antares

1
2
3
4
5
class Company
  include DataMapper::Resource

  property :id,         Integer,  :serial   => true
  property :name,       String,   :nullable => false

May 16, 2008
7:33PM EDT
by antares

1
2
3
4
5
  it "allows wrapping of nested routes all having shared argument with PREDEFINED VALUES" do
    Merb::Router.prepare do |r|
      r.match(/\/?(en|es|fr|be|nl)?/).to(:language => "[1]") do |l|
        l.match("/guides/:action/:id").to(:controller => "tour_guides")
      end

May 16, 2008
7:26PM EDT
by antares

1
2
3
4
5
A route derived from the blocks of #match
- should inherit the :controller option.
- should inherit the :action option.
- should inherit the default :action of 'index'
- should make use of the :params option

May 16, 2008
7:25PM EDT
by antares

1
2
3
4
5
  it "allows wrapping of nested routes all having shared argument" do
    Merb::Router.prepare do |r|
      r.match('/:language') do |i18n|
        i18n.match!('/:controller/:action')
      end

May 16, 2008
7:18PM EDT
by antares

1
2
3
4
5
  it "allows wrapping of nested routes all having shared OPTIONAL argument" do
    Merb::Router.prepare do |r|
      r.match(/\/(.*)?/).to(:language => "[1]") do |l|
        l.match("/guides/:action/:id").to(:controller => "tour_guides")
      end

May 10, 2008
3:00PM EDT
by antares

1
2
3
4
5
require "rubygems"
require "data_mapper"

DataMapper.setup(:backup, {
  :adapter  => "postgres",

May 06, 2008
4:08AM EDT
by antares

1
display @obj, :include => [:beer, :jazz], :except => [:idiots]

May 06, 2008
4:05AM EDT
by antares

1
2
3
4
display :only => [:lat, :lng] do
  # some heavy lifting calculating the entity detouched from controller
  # then calls to_json, for instance, on calculated result
end

May 06, 2008
3:58AM EDT
by antares

1
2
3
display :only => [:lat, :lng] do
  @locations
end

May 05, 2008
5:54PM EDT
by antares

1
2
3
4
5
namespace :deploy do
  desc <<-DESC
    Deploys your project. This calls both `update' and `restart'. Note that \
    this will generally only work for applications that have already been deployed \
    once. For a "cold" deploy, you'll want to take a look at the `deploy:cold' \