# Pre Custom Objects and Stuff - Easy Answer im sure

**URL:** <https://www.ruby-forum.com/t/pre-custom-objects-and-stuff-easy-answer-im-sure/157517>\
**Category:** Rails\
**Created:** [January 12, 2009, 3:31pm UTC](https://www.ruby-forum.com/t/pre-custom-objects-and-stuff-easy-answer-im-sure/157517 "2009-01-12T15:31:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dnstevenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8dc957/32.png) [@dnstevenson](https://www.ruby-forum.com/u/dnstevenson)\
**Post date:** [January 12, 2009, 3:31pm UTC](https://www.ruby-forum.com/t/pre-custom-objects-and-stuff-easy-answer-im-sure/157517/1 "2009-01-12T15:31:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dnstevenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8dc957/32.png) [@dnstevenson](https://www.ruby-forum.com/u/dnstevenson)\
**Post date:** [January 13, 2009, 12:10pm UTC](https://www.ruby-forum.com/t/pre-custom-objects-and-stuff-easy-answer-im-sure/157517/2 "2009-01-13T12:10:53Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![dnstevenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8dc957/32.png) [@dnstevenson](https://www.ruby-forum.com/u/dnstevenson)\
**Post date:** [January 13, 2009, 6:06pm UTC](https://www.ruby-forum.com/t/pre-custom-objects-and-stuff-easy-answer-im-sure/157517/3 "2009-01-13T18:06:09Z")

</div>

[http://api.rubyonrails.org/](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…
