Feature/migration
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
-
-
1 class CreateCompanies < ActiveRecord::Migration[6.0] 2 def change 3 create_table :companies do |t| 4 t.string :username, null: false, default: "" -
Master
sao company lại có username được
-
-
-
1 class CreateIndustryJobs < ActiveRecord::Migration[6.0] 2 def change 3 create_table :industry_jobs do |t| 4 t.integer :job_id -
Master
đánh index vào tất cả các khóa ngoại, các trường unique cũng đánh index luôn để tăng tốc độ truy xuất dữ liệu
-
-
app/models/user_job.rb 0 → 100644
1 class UserJob < ApplicationRecord 2 belongs_to :user 3 belongs_to :jobs -
MasterEdited by Son Do Hong
sai quan hệ.
Em viết như này thì sau này mình sẽ phải gọi là:
UserJob.last.jobsà -
-
-
app/models/user.rb 0 → 100644
1 class User < ApplicationRecord 2 # Include default devise modules. Others available are: 3 # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable 4 devise :database_authenticatable, :registerable, 5 :recoverable, :rememberable, :validatable 6 has_many :user_jobs -
Master
add thêm dòng trống trước phần validation
-
-
app/models/user.rb 0 → 100644
1 class User < ApplicationRecord 2 # Include default devise modules. Others available are: 3 # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable 4 devise :database_authenticatable, :registerable, 5 :recoverable, :rememberable, :validatable 6 has_many :user_jobs 7 validates :email, presence: true, uniqueness: true 8 validates :username, presence: true, format: { with: /\A[A-Za-z][A-Za-z0-9._-]{2,19}\z/ } 9 validates :first_name, presence: true, format: { with: /\A[A-Za-z][A-Za-z0-9._-]{2,19}\z/ } -
Master
format chấp nhận những cái tên như thế nào?
-
-
-
1 # frozen_string_literal: true 2 3 class DeviseCreateUsers < ActiveRecord::Migration[6.0] 4 def change 5 create_table :users do |t| 6 ## Database authenticatable 7 t.string :email, null: false, default: "" 8 t.string :username, null:false, default: "" -
Master
add thêm uniq cho email, username
-
-
-
test/fixtures/cities.yml 0 → 100644
1 # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 3 # This model initially had no columns defined. If you add columns to the 4 # model remove the '{}' from the fixture names and add the columns immediately 5 # below each fixture, per the syntax in the comments below -
Master
xóa các file test chưa dùng đến đi
-
-
-
-
merged
Toggle commit list