I have a couple questions regarding validation.
I have a table with a HABTM relationship to another table. The table
is “task” and it has HABTM “employee_types”. Is there any way to have
a validation to make sure when a task is created it is associated with
at least one “employee_type”? I could include code to make sure of
this in the controller method but I’m wondering there is a built rails
way, or a way to stick a validation method into the “task” model.
a “task” also has the following relationship defined:
has_many :work_area_tasks, :dependent => :destroy, :order => :position
has_many :work_areas, :through => :work_area_tasks
Again, I’d like to make sure at least one “work_area_task” is created
with each “task”.