PG::Error: ERROR: null value in column "created_at" when inserting records into associated model
see below link for your solution.
HABTM
your solution
remove t.timestamps
and then run.
class CreateCategoriesJobs < ActiveRecord::Migration
def change
create_table :categories_jobs, :id => false do |t|
t.integer :category_id
t.integer :job_id
end
end
end
Just use another kind of many-to-many relation declaration.
class Category ...
has_many :categories_jobs
has_many :categories, through: :categories_jobs
...
end
class Job ...
has_many :categories_jobs
has_many :jobs, through: :categories_jobs
...
end
then you will be able to use timestamps.