Pre Custom Objects and Stuff - Easy Answer im sure

Hi Guys,

When I create a project I would like to be able to create a default set
of tasks for that project.

One could have a line for each task to manually add each project_task in
the projects controller when creating the project but that would be poor
programming im sure.!

Is there a way of achieving this, perhaps making pre-customised objects
in a config file or something?

Cheers Folks,

Dave

Dave S. wrote:

Hi Guys,

When I create a project I would like to be able to create a default set
of tasks for that project.

One could have a line for each task to manually add each project_task in
the projects controller when creating the project but that would be poor
programming im sure.!

Is there a way of achieving this, perhaps making pre-customised objects
in a config file or something?

Cheers Folks,

Dave

Any ideas guys?

http://api.rubyonrails.org/

Module
ActiveRecord::Callbacks

Callbacks are hooks into the lifecycle of an Active Record object that
allow you to trigger logic before or after an alteration of the object
state. This can be used to make sure that associated and dependent
objects are deleted when destroy is called (by overwriting
before_destroy) or to massage attributes before they‘re validated (by
overwriting before_validation). As an example of the callbacks
initiated, consider the Base#save call for a new record:

Perhaps an after_save method for your Project class could create a
default set of Tasks…