diff --git a/db/migrate/20240911231807_create_viajes.rb b/db/migrate/20240911231807_create_viajes.rb index 64ed57e..0b1c20b 100644 --- a/db/migrate/20240911231807_create_viajes.rb +++ b/db/migrate/20240911231807_create_viajes.rb @@ -1,6 +1,7 @@ class CreateViajes < ActiveRecord::Migration[7.2] def change create_table :viajes do |t| + t.belongs_to :ruta t.string :direccion_partida t.string :direccion_llegada t.integer :kms diff --git a/db/migrate/20240911233401_create_entregas.rb b/db/migrate/20240911233401_create_entregas.rb index d75cb80..d7b7774 100644 --- a/db/migrate/20240911233401_create_entregas.rb +++ b/db/migrate/20240911233401_create_entregas.rb @@ -1,6 +1,7 @@ class CreateEntregas < ActiveRecord::Migration[7.2] def change create_table :entregas do |t| + t.belongs_to :viaje t.string :nombre_recibe # Quien recibe t.text :carga # Detalles de la carga, serializado t.timestamps diff --git a/db/migrate/20240911233430_create_retiros.rb b/db/migrate/20240911233430_create_retiros.rb index e728779..bedc4d8 100644 --- a/db/migrate/20240911233430_create_retiros.rb +++ b/db/migrate/20240911233430_create_retiros.rb @@ -1,6 +1,7 @@ class CreateRetiros < ActiveRecord::Migration[7.2] def change create_table :retiros do |t| + t.belongs_to :viaje t.string :nombre_entrega # Quien entrega t.text :carga # Detalles de la carga, serializado t.timestamps diff --git a/db/schema.rb b/db/schema.rb index c09a67e..ca36a83 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,17 +12,21 @@ ActiveRecord::Schema[7.2].define(version: 2024_09_11_233430) do create_table "entregas", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + t.bigint "viaje_id" t.string "nombre_recibe" t.text "carga" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["viaje_id"], name: "index_entregas_on_viaje_id" end create_table "retiros", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + t.bigint "viaje_id" t.string "nombre_entrega" t.text "carga" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["viaje_id"], name: "index_retiros_on_viaje_id" end create_table "ruta", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| @@ -31,10 +35,12 @@ ActiveRecord::Schema[7.2].define(version: 2024_09_11_233430) do end create_table "viajes", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + t.bigint "ruta_id" t.string "direccion_partida" t.string "direccion_llegada" t.integer "kms" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["ruta_id"], name: "index_viajes_on_ruta_id" end end diff --git a/test/models/ruta_test.rb b/test/models/ruta_test.rb index 87e5d82..2d5f46b 100644 --- a/test/models/ruta_test.rb +++ b/test/models/ruta_test.rb @@ -10,6 +10,6 @@ class RutaTest < ActiveSupport::TestCase test "get" do ruta = Ruta.find(1) - assert Ruta.id === 1 + assert ruta.id === 1 end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 0c22470..7d4b674 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -11,5 +11,11 @@ module ActiveSupport fixtures :all # Add more helper methods to be used by all tests here... + def ruta_get_url + "/ruta" + end + def ruta_add_url + "/ruta" + end end end