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 || {}) |
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
<!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
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
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
#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
module DataMapper | |
module MyHelpers | |
def all_errors(seen=[]) | |
return [] if seen.include?(self) | |
seen << self | |
res = self.errors | |
parent_relationships.each do |relationship| | |
association = relationship.get!(self) |
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
# Usage: | |
# | |
# customers = Customer.all | |
# customers.eager_load(Customer.orders.line_items.item, Customer.address) | |
# | |
module DataMapper | |
module EagerLoading | |
def eager_load(*query_paths) |
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
if RUBY_PLATFORM =~ /java/ | |
require 'java' | |
# Add ojdbc to the Java classpath | |
$CLASSPATH << File.expand_path('../../lib/ojdbc5.jar', __FILE__) | |
# Simply add all apache tomcat libs (some juli.jar might need to be added too) | |
Dir.glob("/usr/local/Cellar/apache-tomcat/6.0.24/lib/*.jar") do |filename| | |
$CLASSPATH << filename | |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" /> | |
<meta charset="UTF-8" /> | |
<title> | |
Story: 1828128 from BAB / BNH, page 3 from Thursday, July 25, 2013 – DC-X 1.7.8.0 BTAG API | |
</title> | |
<link href="http://dcxtrunk.digicol.de/dcx_static/trunk/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet" /> | |
</head> |
OlderNewer