This is too much for my ruby skills level...
Since i can't use multiple tables inheritance, i've been trying to
implement some shared behaviour and state in an AR 'wrapper' model
that delegates method calls to an associated business objects through
a polymorphic association

class CoreEntity < ActiveRecord::Base
  belongs_to :business, :polymorphic => true

end

class FirstBusinessEntity < ActiveRecord::Base
  has_one :core_entity, :as => :business

  def some_business_method
    return true
  end
end


in the CoreEntity class, i can hard code :
delegate :some_business_method, :to => :business
and it works fine, but as soon as i'll need to associate a different
business entity, i'm screwed.

Can I dynamically set the delegate parameters, depending on the
associated business object ?
Or am i looking at this the wrong way ?

cheers

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to