On Wed, Feb 8, 2012 at 10:39 AM, Colin Law wrote:
> On 8 February 2012 07:12, Bob Smith wrote:
> > I need a way to set a counter that will show how many of the model
> > have been created and put this in each instance. This will allow me to
> > use the record number as an input to another field
On 08.02.2012, at 15:05, grentis wrote:
> You can use also after_initialize checking if the counter is already setted
>
> after_initialize :set_counter
>
> def set_counter
> self.counter ||= ModelName.all.count
> end
Imagine 'create' action.
During the period from the instance is initializ
On 08.02.2012, at 13:39, Colin Law wrote:
> On 8 February 2012 07:12, Bob Smith wrote:
>> I need a way to set a counter that will show how many of the model
>> have been created and put this in each instance. This will allow me to
>> use the record number as an input to another field before id i
On 8 February 2012 07:12, Bob Smith wrote:
> I need a way to set a counter that will show how many of the model
> have been created and put this in each instance. This will allow me to
> use the record number as an input to another field before id is set.
> After things are settled, the real id nu
I need a way to set a counter that will show how many of the model
have been created and put this in each instance. This will allow me to
use the record number as an input to another field before id is set.
After things are settled, the real id number can be substituted for
the counter.
I've tried
5 matches
Mail list logo