mcfoton said over 4 years ago on Working with Large Data :
Thanks a lot for the episode! Tip: instead of Time.now (in the seed file) you can use Time.current, that automatically takes zone into account if you have any set up in the app :) https://apidock.com/rails/Time/current/class

Uriel said over 4 years ago on Working with Large Data :
Thank you for the episode, greats!

Olaoluwa Afolabi said over 4 years ago on Working with Large Data :
In a case where you want to update `VehicleTracker` table such that you find a record with `VehicleTracker.find(params[:id])`, how will you go about it?

Olaoluwa Afolabi said over 4 years ago on Working with Large Data :
The reason am asking is that you have suppressed `:id` from being created on `VehicleTrackers` table, In a case where you have vehicle_id column relation on `VehicleTracker` which is the same `id` for any record created by `Vehicle` on `VehicleTracker table`, how do you have a unique `params[:id]` to filter and update a table?

David Kimura PRO said over 4 years ago on Working with Large Data :
yes, if you are having to modify the table records like that then a bigint as the primary key or a uuid would be necessary.

Olaoluwa Afolabi said over 4 years ago on Working with Large Data :
Okay, so something like this will do: ``` class CreateEntries < ActiveRecord::Migration[6.0] def change create_table :entries, primary_key: :user_id, id: false do |t| t.bigint :user_id, null: false, foreign_key: true t.string :purpose, null: false t.datetime :time_in t.datetime :time_out t.timestamps end add_index :entries, %i[user_id purpose time_in time_out] end end ```

David Kimura PRO said over 4 years ago on Working with Large Data :
just remove the id set to false. you wouldnt want to make the user id the primary key

Login to Comment