It's not really, think of it more like a cache of the amount. :P

You can even make it per order and then actually do a sum against that
as a low (lower at least) cost way of calculating.  Which might be a
safer way to do it, keep the lifecycle method to signal order
completion and actual removal from stock but use the cached calc to
make a projected inventory level.

On Oct 26, 2:17 pm, Archfile X <[email protected]> wrote:
> kevin, that (despite being a bit like a global variable -- I won't
> tell if you don't) sounds like in this limited application would work
> perfectly for what i've got in mind, its not pretty, but will work
> exactly how i want I think.
>
> You are a genius sir, my hat comes off for the idea :-P
>
> On Oct 27, 6:49 am, kevinpfromnm <[email protected]> wrote:
>
> > The other non hobo way would be to update the values with an
> > after_save callback.  If it's new, drop the levels by whole amount of
> > order, if not, just the difference.  Though Bryan does bring up a good
> > point that you don't want changes after the order is already done, but
> > again permissions changes take care of that.
>
> > On Oct 25, 5:05 pm, Archfile X <[email protected]> wrote:
>
> > > Excellent, thank you most kindly, that helps a great deal, it is not
> > > practical
> > > to calculate the stock levels from a function for the reason you
> > > outlined.
>
> > > From a practical point of view, we are talking about using the
> > > controller
> > > to perform the lifecycle, so using some sort of update controller with
> > > a clause to specify which lifecycle is currently valid. I recall
> > > seeing this
> > > somewhere.
>
> > > is it too much trouble to get you to show me an example (code) that
> > > would work to perform the change, even psuedo code
>
> > > it would be easier to use a simpler example, say if the user model
> > > had
>
> > > user
> > >  +paid_for_subject:integer
>
> > > subjects
> > >   -> name: string
> > >       has_ many :users through user_allocations, accessible 'true'
>
> > > user_allocation
>
> > > how would i make the controller deduct 1 'paid_for_subject' when the
> > > allocation is added to the subjects
>
> > > again, thanks for all the help
> > > Arch
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to