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
#test "makes sure interpolation does not break even with False as string" do | |
# assert_equal "translation missing: en, support, array, skip_last_comma", I18n.translate(:"support.array.skip_last_comma") | |
#end | |
test "returns missing translation string for missing key" do | |
assert_equal "translation missing: hu, foo, bar, huu", I18n.translate(:"foo.bar.huu", :locale => :hu) | |
end | |
test "returns false translation" do |
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
ActiveRecord::ConnectionAdapters::AbstractAdapter.class_eval do | |
def log_with_blobs_trimmed(sql, name, &block) | |
sql = sql.gsub(/x'([^']+)'/) do |blob| | |
blob.size > 32 ? "x'#{$1[0,32]}... (#{blob.size} bytes)'" : $0 | |
end if sql | |
log_without_blobs_trimmed(sql, name, &block) | |
end | |
alias_method_chain :log, :blobs_trimmed |
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
.gist { | |
color: /* #000 */ #9B703F; | |
} | |
.gist div { | |
padding: 0; | |
margin: 0; | |
} | |
.gist .gist-file { | |
border: 1px solid #dedede; /* gray */ | |
font-family: Monaco, "Courier New", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace; |
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
# Patch request to receive exceptions from body parsing (e.g. XML parsing) | |
ActionController::AbstractRequest.class_eval do | |
alias_method :parse_formatted_request_parameters_unsafely, :parse_formatted_request_parameters | |
def parse_formatted_request_parameters | |
begin | |
parse_formatted_request_parameters_unsafely #super | |
rescue Exception => e # YAML, XML or Ruby code block errors | |
self.env['EXCEPTION'] = e # there will be a before filter to check for this and re-raise |
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
class ApplicationController < ActionController::Base | |
rescue_from 'REXML::ParseException' do |exception| | |
render :text => exception.to_s, :status => 422 | |
end | |
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
<!-- @see docs http://bit.ly/41H6jr --> | |
<container-descriptor> | |
<prefer-web-inf-classes>true</prefer-web-inf-classes> | |
</container-descriptor> |
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 assert_json_parse_exception(error) | |
if ActiveSupport::JSON.respond_to?(:parse_error) # 2.3.5 | |
parse_error_class = ActiveSupport::JSON.parse_error | |
assert_instance_of parse_error_class, error | |
else | |
assert_instance_of ActiveSupport::JSON::ParseError, error | |
end | |
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
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | |
version="2.5"> | |
<display-name>webapp</display-name> | |
<context-param> | |
<param-name>SOME_PORT</param-name> | |
<param-value>8080</param-value> | |
</context-param> | |
<!-- ... rest omited ... --> | |
</web-app> |
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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>org.kares</groupId> | |
<artifactId>webapp</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<packaging>war</packaging> | |
<name>webapp</name> | |
<dependencies> | |
<dependency> |
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 overrideResourcesDir = project.properties["override.resources.dir"] | |
if (new File( overrideResourcesDir ).exists()) { | |
log.info("cleaning contents of directory $overrideResourcesDir") | |
ant.delete { fileset(dir: overrideResourcesDir, includes: "**") } | |
} | |
else { | |
new File( overrideResourcesDir ).mkdirs() // webResource - should exist | |
} | |
def SOME_PORT = project.properties["SOME_PORT"] | |
if (SOME_PORT) { // if not set don't touch the web.xml |
OlderNewer