Hello everyone, I’m trying to have multiple models which inherits from the devise User model. I’ve made the following migration files:
# frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[7.1]
def change
create_table :users do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
t.string :username, null: false, default: ""
t.string :name
t.string :surname
t.string :address
t.string :phone
t.string :mobile
t.string :city
t.string :region
t.string :state
t.string :country
t.string :avatar
t.string :type
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
## Rememberable
t.datetime :remember_created_at
# Trackable
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
t.string :last_sign_in_ip
# Confirmable
t.string :confirmation_token
t.datetime :confirmed_at
t.datetime :confirmation_sent_at
t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
t.timestamps null: false
end
add_index :users, :email, unique: true
add_index :users, :reset_password_token, unique: true
add_index :users, :username, unique: true
# add_index :users, :confirmation_token, unique: true
# add_index :users, :unlock_token, unique: true
end
end
and
class CreateTechnicians < ActiveRecord::Migration[7.1]
def change
create_table :technicians do |t|
t.float :working_hours
t.float :lunch_break
t.float :time_to_get_back
end
end
end
the schema.rb then is as follows:
create_table "technicians", force: :cascade do |t|
t.float "working_hours"
t.float "lunch_break"
t.float "time_to_get_back"
end
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "username", default: "", null: false
t.string "name"
t.string "surname"
t.string "address"
t.string "phone"
t.string "mobile"
t.string "city"
t.string "region"
t.string "state"
t.string "country"
t.string "avatar"
t.string "type"
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["email"], name: "index_users_on_email", unique: true
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
t.index ["username"], name: "index_users_on_username", unique: true
end
but when I try to do t=Technician.new
and then I do t.attributes
I only see the attributes defined in the users migration and not the ones defined in the technicians migration. Does anybody have any idea as to why?