So I'm learning how to deal with lifecycles. No more web-methods for
me!! I'm pretty sure I've set this up right, here's my model:
class Order < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
timestamps
dummy :boolean
end
belongs_to :user, :creator => true
has_many :items
#--- Lifecycle ---#
lifecycle do
state :initialized, :default => true
state :sent, :cooking, :delivering, :delivered
create :foodOrder, :params => [:menu], :become
=> :initialized,
:available_to => "User",
:user_becomes => :customer
transition :send, {:initialized => :sent}
transition :sentToCook, {:sent => :cooking}
transition :sentToDeliveryBoy, {:cooking => :delivering}
transition :delivered, {:delivering => :delivered }
end
# --- Permissions --- #
def create_permitted?
acting_user.signed_up?
end
def update_permitted?
user_is?(acting_user) || acting_user.administrator? ||
acting_user.chef?
end
def destroy_permitted?
acting_user.administrator?
end
def view_permitted?(field)
user_is?(acting_user) || acting_user.administrator? ||
acting_user.chef?
end
end
I'm kinda ignoring the :menu param, that's something i want to play
with later...
for now, i just want the transition buttons to show up on my edit
page, which I can't seem to get them to render. under views/orders in
my edit.dryml i have
<edit-page>
<append-content-body:>
<p> some buttons </p>
<transition-buttons/>
</append-content-body:>
</edit-page>
but no buttons show up! I'm pretty sure my permissions are ok, so
what the heck is going on? My state is showing up on the show page as
initialized, but there are no buttons!
--
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.