On Wed, May 25, 2011 at 08:59:59AM -0700, Eric wrote:
> 
> We tend to workflow things like projects, invoices, request. What we
> ultimately want to end up with is something like:
> 
> Clase Project < ActiveRecord::Base
>   :has_many :processes
>   :has_many :workitems thru => processes
> end
> 
> But we don't want to "contaminate" ruotes data structures with our
> business logic/data. It might be interesting to pass a model name and
> id into ruote when a process or workitem is created and extend the
> ruote-sequal structure so that you could create a polymorfic relation
> to other tables. Currently we pass the relation data into the process/
> workitem but we have to dig it out of the hash.

Hello,

for some projects I re-open Ruote::Workitem and do things like :

  class Ruote::Workitem
    def project
      ::Project.find(self.fields['project_id']
    end
  end

or

  class Ruote::Workitem
    def method_missing(m, *args)
      id = self.fields["#{m}_id"]
      klass = (m.to_s.camelize.constantize rescue nil)
      return klass.find(id) if id and klass
      super
    end
  end

or do it via modules. Not too intrusive, but some future workflows may not have 
a link to projects.


> Thank for the help and the participant lesson.

Sorry if it felt like a lesson, the set of questions was quite dense.


Best regards,

-- 
John Mettraux - http://jmettraux.wordpress.com

-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en

Reply via email to