-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Hi,
I have the following classes on my system:
class Event < ActiveRecord::Base
has_many :event_approval_requests
belongs_to :user
include Workflow
workflow do
state :pre_registered do
event :submit, :transitions_to => :awaiting_approval
end
state :awaiting_approval do
event :approve, :transitions_to => :approved
event :reject, :transitions_to => :rejected
end
state :approved do
event :submit, :transitions_to => :awaiting_approval
end
state :rejected do
event :submit, :transitions_to => :awaiting_approval
end
end
...
end
class EventApprovalRequest < ActiveRecord::Base
belongs_to :user
belongs_to :department
belongs_to :event
include Workflow
workflow do
state :pending do
event :approve, :transitions_to => :approved
event :reject, :transitions_to => :rejected
end
state :approved
state :rejected
end
...
end
Note that the two classes have workflow definitions and one have a relationship with the other. In a view, when I try to access the event from the event_approval_request like below:
<%=h event_approval_request.event.title %>
I got the following error: NoMethodError in Event_approval_requests#index undefined method `find' for Workflow::Event:Class
this error doesn't occur if I access a non-workflow class, like below:
<%=h event_approval_request.user.first_name %>
Could anyone help me? Is it really an issue?
Thanks in advance,
Gustavo
Metadata
Metadata
Assignees
Labels
No labels