Created
January 10, 2017 01:27
-
-
Save panthomakos/11fb27801014e557a9a67e9fbc31c05b to your computer and use it in GitHub Desktop.
Hanami Model Primary Key Exception
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
source 'https://rubygems.org' | |
gem 'sqlite3' | |
gem 'hanami-model' |
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
GEM | |
remote: https://rubygems.org/ | |
specs: | |
concurrent-ruby (1.0.4) | |
dry-configurable (0.5.0) | |
concurrent-ruby (~> 1.0) | |
dry-container (0.6.0) | |
concurrent-ruby (~> 1.0) | |
dry-configurable (~> 0.1, >= 0.1.3) | |
dry-core (0.2.3) | |
concurrent-ruby (~> 1.0) | |
dry-equalizer (0.2.0) | |
dry-logic (0.4.0) | |
dry-container (~> 0.2, >= 0.2.6) | |
dry-core (~> 0.1) | |
dry-equalizer (~> 0.2) | |
dry-types (0.9.3) | |
concurrent-ruby (~> 1.0) | |
dry-configurable (~> 0.1) | |
dry-container (~> 0.3) | |
dry-core (~> 0.2, >= 0.2.1) | |
dry-equalizer (~> 0.2) | |
dry-logic (~> 0.4, >= 0.4.0) | |
inflecto (~> 0.0.0, >= 0.0.2) | |
hanami-model (0.7.0) | |
concurrent-ruby (~> 1.0) | |
dry-types (~> 0.9) | |
hanami-utils (~> 0.8) | |
rom-repository (~> 0.3) | |
rom-sql (~> 0.9) | |
hanami-utils (0.9.2) | |
inflecto (0.0.2) | |
rom (2.0.2) | |
concurrent-ruby (~> 1.0) | |
dry-equalizer (~> 0.2) | |
dry-types (~> 0.8) | |
rom-mapper (~> 0.4.0) | |
rom-support (~> 2.0) | |
rom-mapper (0.4.0) | |
dry-equalizer (~> 0.2) | |
rom-support (~> 2.0.0) | |
transproc (~> 0.4.0) | |
rom-repository (0.3.1) | |
rom (~> 2.0) | |
rom-mapper (~> 0.4) | |
rom-support (~> 2.0) | |
rom-sql (0.9.1) | |
dry-core (~> 0.2) | |
dry-equalizer (~> 0.2) | |
dry-types (~> 0.9) | |
rom (~> 2.0) | |
rom-support (~> 2.0) | |
sequel (~> 4.25) | |
rom-support (2.0.0) | |
concurrent-ruby (~> 1.0) | |
dry-equalizer (~> 0.2) | |
transproc (~> 0.4.0) | |
wisper (~> 1.6, >= 1.6.0) | |
sequel (4.42.0) | |
sqlite3 (1.3.13) | |
transproc (0.4.1) | |
wisper (1.6.1) | |
PLATFORMS | |
ruby | |
DEPENDENCIES | |
hanami-model | |
sqlite3 | |
BUNDLED WITH | |
1.12.5 |
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
require 'sequel' | |
require 'hanami/model' | |
require 'hanami/model/sql' | |
DB = Sequel.connect('sqlite://test.db?mode=memory&cache=shared') | |
DB.create_table? :users do | |
String :username, primary_key: true | |
end | |
class User < ::Hanami::Entity | |
attributes do | |
attribute :username, Types::String | |
end | |
end | |
class UserRepository < ::Hanami::Repository | |
end | |
Hanami::Model.configure do | |
adapter :sql, 'sqlite://test.db?mode=memory&cache=shared' | |
end | |
Hanami::Model.load! | |
UserRepository.new.create(username: 'foo') |
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
$HOME/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/hanami-model-0.7.0/lib/hanami/repository.rb:302:in `rescue in create': comparison of String with 0 failed (Hanami::Model::Error) | |
from $HOME/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/hanami-model-0.7.0/lib/hanami/repository.rb:300:in `create' | |
from main.rb:26:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment