Skip to content

Instantly share code, notes, and snippets.

class Match < Sequel::Model
validates do
presence_of :first_player_id
presence_of :second_player_id
presence_of :happens_at
presence_of :sport_id
end
def validate
super
match('/profile').to(:controller => :users, :action => :show).send(:register_resource, "user")
match('/account').to(:controller => :users, :action => :edit).send(:register_resource, "user", "edit")
match('/register').to(:controller => :users) do
match(:method => 'get').to(:action => 'new').send(:register_resource, "user", "new")
match(:method => 'post').to(:action => 'create').send(:register_resource, "user", "create")
end
class Project
include MongoMapper::Document
key :name, String
key :budget, Integer
key :details
def type
details.class.to_s.gsub("Project", "")
end
class Project
include MongoMapper::Document
key :name, String
key :budget, Integer
key :type, String
key :details
end
class DesignProject
(ratata) ~/projects/ark.rango # ./init.rb
[18:26:28] Loading dependencies for development
/home/neaf/projects/ark.rango/gems/gems/rango-0.1.1.3/lib/rango/helpers/assets.rb:7:in `require': no such file to load -- media-path (LoadError)
from /home/neaf/projects/ark.rango/gems/gems/rango-0.1.1.3/lib/rango/helpers/assets.rb:7:in `<top (required)>'
from /home/neaf/projects/ark.rango/gems/gems/rango-0.1.1.3/lib/rango/helpers.rb:21:in `require'
from /home/neaf/projects/ark.rango/gems/gems/rango-0.1.1.3/lib/rango/helpers.rb:21:in `<top (required)>'
from /home/neaf/projects/ark.rango/views.rb:3:in `require'
from /home/neaf/projects/ark.rango/views.rb:3:in `<top (required)>'
from <internal:prelude>:34:in `require'
from <internal:prelude>:34:in `require_relative'
(ratata) ~/projects/ark.rango # ./init.rb -i
[18:29:02] Loading dependencies for development
/home/neaf/projects/ark.rango/init.rb:21: warning: already initialized constant RACK_ENV
[18:29:02] Loading dependencies for development
[18:29:02] Using router usher
config.ru:17:in `block (2 levels) in start!': undefined method `rango' for Ark:Module (NoMethodError)
from /home/neaf/projects/ark.rango/gems/gems/usher-0.6.0/lib/usher/interface/rack.rb:44:in `instance_eval'
from /home/neaf/projects/ark.rango/gems/gems/usher-0.6.0/lib/usher/interface/rack.rb:44:in `initialize'
from /home/neaf/projects/ark.rango/gems/gems/usher-0.6.0/lib/usher/interface.rb:32:in `new'
from /home/neaf/projects/ark.rango/gems/gems/usher-0.6.0/lib/usher/interface.rb:32:in `for'
# encoding: utf-8
require_relative "forms/users.rb"
module Ark
class Users < Application
# GET /clients
def index
@users = User.all
# encoding: utf-8
require_relative "forms/users.rb"
module Ark
class Users < Application
# GET /clients
def index
@users = User.all
Merb::Router::Behavior.class_eval do
def add_resource(*key)
register_resource(*key)
end
end
Merb.logger.info("Compiling routes...")
Merb::Router.prepare do
slice(:merb_auth_slice_password, :name_prefix => nil, :path_prefix => "")
[:design, :markup, :flash, :cms].each do |type|
unless data.has_key?("include_#{type}".to_sym)
cleaned_data.reject! { |key, value| key.match(/^#{type}/) }
errors.reject! { |key, value| key.match(/^#{type}/) }
end
end