This file contains hidden or 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
| { | |
| [ | |
| { | |
| "_type": "ServerError", | |
| "name": "RuntimeError", | |
| "parameters": { | |
| "format": null, | |
| "registered_template_id": "242", | |
| "action": "show", | |
| "id": "1727", |
This file contains hidden or 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 Exceptions < Application | |
| provides :sscj1 | |
| # handle NotFound exceptions (404) | |
| def not_found | |
| standard_error if content_type == :sscj1 | |
| render | |
| end | |
| # handle NotAcceptable exceptions (406) |
This file contains hidden or 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 Exceptions < Application | |
| provides :sscj1 | |
| # handle NotFound exceptions (404) | |
| def not_found | |
| if content_type == :sscj1 | |
| standard_error | |
| Merb.logger.info _template_for(:standard_error, :sscj1, controller_name, nil).inspect | |
| render :standard_error | |
| else |
This file contains hidden or 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
| # Turn [[WikiLinks]] into internal links. | |
| # add the `wikiwords` filter to your list of filters, then you can write | |
| # links to other pages in your webby app like this [[OtherPage]] and it will | |
| # automatically link that to "/OtherPage.html" | |
| module WikiLinkHelper | |
| def linkify_bracketed_phrases(string) | |
| string.gsub(/\[\[([^\]]+)\]\]/) do | |
| begin | |
| link_to_page($1) |
This file contains hidden or 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
| irb(main):002:0> require 'uuidtools' | |
| => true | |
| irb(main):003:0> id = UUID.random_create | |
| => #<UUID:0x-243e2990 UUID:2ed4542b-52ec-4f8e-b166-1514874bb169> | |
| irb(main):004:0> things = {} | |
| => {} | |
| irb(main):005:0> things[id] = "foo" | |
| => "foo" | |
| irb(main):006:0> things[id] | |
| => "foo" |
This file contains hidden or 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
| irb(main):002:0> require 'uuidtools' | |
| => true | |
| irb(main):003:0> u = UUID.random_create | |
| => #<UUID:0x-24390924 UUID:961537fc-4670-4088-a25d-814723d998e1> | |
| irb(main):004:0> [u] | |
| => [#<UUID:0x-24390924 UUID:961537fc-4670-4088-a25d-814723d998e1>] | |
| irb(main):005:0> [u].hash | |
| RangeError: bignum too big to convert into `long' | |
| irb(main):006:0> u.hash | |
| => 199494373121591421883459330646478526689 |
This file contains hidden or 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
| irb(main):009:0> id = 2 ** 256 | |
| => 115792089237316195423570985008687907853269984665640564039457584007913129639936 | |
| irb(main):010:0> things[[id]] | |
| => nil | |
| irb(main):014:0> id = UUID.random_create | |
| => #<UUID:0x-2422d154 UUID:dc6d7b50-5720-425f-933d-6c9eb005208e> | |
| irb(main):015:0> things[[id]] | |
| RangeError: bignum too big to convert into `long' | |
| from (irb):15:in `hash' |
This file contains hidden or 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 PostgresAdapter | |
| def translate_attribute(attribute) | |
| case attribute | |
| when Numeric | |
| attribute.value | |
| when String | |
| quote_string(attribute.value) | |
| when Array | |
| attribute.value.map { |v| translate_attribute(v) }.join(',') |
This file contains hidden or 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 DataMapper::Property | |
| # translate the value from external source to expected object | |
| def typecast(value) | |
| value | |
| end | |
| # translate the value from the primitive to expected object | |
| def load(value) | |
| value |
This file contains hidden or 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
| paul=# CREATE TABLE test (name VARCHAR(5)); | |
| CREATE TABLE | |
| paul=# INSERT INTO TEST (name) VALUES ('123456'); | |
| ERROR: value too long for type character varying(5) |