...reading through the rails api...
My best guess (doing it the hard way) would be some fancy combination
of activerecord calls to:
1) create a new order_assist
2) set the order_id
3) set the item_id
is that all i'd have to do? What kind of syntax would I use inside a
lifecycle to get this to happen? would it be like what I suggest
below?
transition :add_to_order, {:not_in_order => :in_order},
:available_to => "User", do
<%= rails api calls %>
end
The more I read the more questions I have, so I'll stop here and see
what anyone might have to say!!
-hoboHippy
On Oct 23, 8:37 am, hobo_hippy <[email protected]> wrote:
> on further thought, should I define a function in the model and call
> that function with the lifecycle? really, the problem I'm having is I
> have no idea on how to "manually" associate any particular item with a
> particular order. I hope someone has run into this sort of thing
> before and has an example!!!
>
> -hoboHippy
>
> On Oct 23, 8:29 am, hobo_hippy <[email protected]> wrote:
>
>
>
>
>
>
>
> > I have three (really 4) classes working together: menus, items, orders
> > (and order_assists). Their associations are listed below. I have
> > lifecycles setup for items with two states, :in_order
> > and :not_in_order. I'm already showing items on the menu show page
> > (using auto actions for) and have edited the item cards such that the
> > transition button shows on the card. This is all great! However, I'm
> > shooting for having the transition associate the item to the current
> > user's order (I can just assume the current user has an order
> > already). I don't see any documentation in any tutorials or in the
> > manual on how to accomplish this.
>
> > Can it be done? Or do I want to do this another way? Create a custom
> > form somehow? Please advise!
>
> > menus:
> > has_many :items, :dependent => :destroy
> > has_many :orders
>
> > items:
> > belongs_to :menu
> > has_many :order_assist
> > has_many :orders, :through => :order_assist, :accessible => true
>
> > orders:
> > belongs_to :user, :creator => true
> > belongs_to :menu
> > has_many :order_assist
> > has_many :items, :through => :order_assist, :accessible => true
>
> > order_assists:
> > belongs_to :order
> > belongs_to :item
> > belongs_to :menu
>
> > -HoboHippy
--
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.