I'm new to rails/ruby and I was wondering how I can double check if my database schema is correctly built in rails console
In rails c
ActiveRecord::Base.connection.tables
gave me the output of
["schema_migrations", "users", "expense_pictures", "income_pictures", "income_texts", "expense_texts"]
How can I check within the console that I have the following schema correctly built?
From user to IncomePictures and ExpensePictures are foreign keys. IncomePictures to ExpensePictures are also foreign keys to their appropriate texts
Here are my models:
class ExpensePicture < ActiveRecord::Base
belongs_to :user
mount_uploader :image, ImageUploader
has_one :expense_text
end
class ExpenseText < ActiveRecord::Base
belongs_to :expense_pictures
end
class IncomePicture < ActiveRecord::Base
belongs_to :user
mount_uploader :image, ImageUploader
has_one :income_text
end
class IncomeText < ActiveRecord::Base
belongs_to :income_pictures
end
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:rememberable, :validatable
has_many :expense_pictures
has_many :income_pictures
end