rake test
Run options: --seed 42414
# Running:
E
Error:
NinoninoControllerTest#test_should_get_index:
ActiveRecord::ValueTooLong: Mysql2::Error: Data too long for column 'codigo_departamento' at row 1: INSERT INTO `municipios` (`codigo`, `nombre`, `created_at`, `updated_at`, `id`, `codigo_departamento`) VALUES ('001', 'MyString', '2018-10-11 18:08:52', '2018-10-11 18:08:52', 980190962, '980190962')
bin/rails test test/controllers/ninonino_controller_test.rb:4
require 'test_helper'
class GruposControllerTest < ActionDispatch::IntegrationTest
setup do
@grupo = grupos(:one)
end
test "should get index" do
get grupos_url
assert_response :success
end
(...)
end
one:
departamento: one
codigo: '001'
nombre: MyString
two:
departamento: two
codigo: '002'
nombre: MyString
one:
codigo: '01'
nombre: MyString
two:
codigo: '02'
nombre: MyString
ActiveRecord::Schema.define(version: 20180929202221) do
create_table "departamentos", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "codigo", limit: 2
t.string "nombre"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["codigo"], name: "index_departamentos_on_codigo", unique: true
end
create_table "municipios", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "codigo", limit: 3
t.string "nombre"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "codigo_departamento", limit: 2
t.index ["codigo_departamento"], name: "municipios_departamento_id"
end
(...)
end
--
--
You received this message because you are subscribed to the Google
Groups "ror-es" group.
To post to this group, send email to ror...@googlegroups.com
To unsubscribe from this group, send email to
ror_es+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/ror_es?hl=en
Rails no escala.
---
You received this message because you are subscribed to the Google Groups "ror-es" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ror_es+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
one:
id: 1
departamento: one
codigo: '001'
nombre: MyString
one:
id: 1
codigo: '01'
nombre: MyString
class Municipio < ApplicationRecord
belongs_to :departamento, primary_key: 'codigo', foreign_key: 'codigo_departamento'
end
class Municipio < ApplicationRecord
belongs_to :departamento, primary_key: 'codigo', foreign_key: 'codigo_departamento'
end