This file contains 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
#libaries | |
require 'rubygems' rescue nil | |
require 'irb/completion' | |
begin | |
# load hirb | |
$: << '/Library/Ruby/Gems/1.8/gems/hirb-0.5.0/lib' | |
require "hirb" | |
# start hirb |
This file contains 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
def create_index_statement(model, index_name, fields) | |
table_name = model.storage_name(name) | |
table_name_short = table_name.split("_").map{|s|s[0..3]}.join("_") | |
DataMapper::Ext::String.compress_lines(<<-SQL) | |
CREATE INDEX #{quote_name("i_#{table_name_short}_#{index_name}")} ON | |
#{quote_name(table_name)} (#{fields.map { |field| quote_name(field) }.join(', ')}) | |
SQL | |
end |
This file contains 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
1) | |
'DataMapper::Adapters::OracleAdapter#create serial properties should not send NULL values' FAILED | |
expected: /\AINSERT INTO "ARTICLES" \("ID"\) VALUES \(DEFAULT\) RETURNING "ID"/, | |
got: " ~ (0,033) INSERT INTO \"ARTICLES\" (\"ID\") VALUES (DEFAULT) RETURNING \"ID\" INTO ?" (using =~) | |
2) | |
'DataMapper::Adapters::OracleAdapter#create properties without a default should not send NULL values' FAILED | |
expected: /^INSERT INTO "articles" \("id"\) VALUES \(('.{1,2}'|.{1,2})\)$/i, | |
got: " ~ (0,005) INSERT INTO \"ARTICLES\" (\"ID\") VALUES (?)" (using =~) |
This file contains 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
<!DOCTYPE html> | |
<html lang="de"> | |
<head> | |
<title>HTML5 Dokument</title> | |
<meta charset="utf-8"> | |
</head> | |
<body> | |
<header> | |
<h1>Der Header</h1> | |
</header> |
This file contains 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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html lang="de"> | |
<head> | |
<title>HTML4 Dokument</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
</head> | |
<body> | |
<div id="branding"> | |
<h1>Der Header</h1> | |
</div> |
This file contains 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
before_filter :ensure_extension | |
# Force an extension to every url. (LD) | |
def ensure_extension | |
redirect_to url_for(:format => (request.format && request.format.symbol) || :html) unless params[:format] | |
end | |
# Set a default value for the :format parameter in url_for and *_url/*_path methods. | |
def default_url_options(options = nil) | |
{:format => params[:format]}.merge(options || {}) |
NewerOlder