Job Model
schema "jobs" do
belongs_to :status, Test.JobStatus,
foreign_key: :status_id,
references: :id,
type: :string
timestamps()
end
and I have a status Model as:
@primary_key {:id, :string, autogenerate: false}
schema "job_statuses" do
field :title, :string
field :description, :string
end
When I am inserting the job I need to put default job status(if its not in params). I know about defaults in belongs_to association but this thing is for perhaps to assign default values when you are assiging a relationship. Can any one point me how I can put default status for any newly created job(assumed job status id is acitve
and its already in the database ) . sample is already here https://github.com/idi-ot/jobs