Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method `find' for Workflow::Event:Class #1

Open
gushonorato opened this issue Aug 19, 2010 · 0 comments
Open

undefined method `find' for Workflow::Event:Class #1

gushonorato opened this issue Aug 19, 2010 · 0 comments

Comments

@gushonorato
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant