Gaudi Mi wrote:
> Having problems with STI.  Names below have been changed to protect the
> innocent.  Imagine a system that allows someone to apply for one of two
> different types of school scholarships.  Each scholarship goes through a
> different review process, represented by a state machine (this is not a
> state machine question).  So there are two state machine classes that
> differ slightly and subclass a generic StateMachine:
> 
> class ScholarshipApplication
>   belongs_to :state_machine
> end
> 
> class StateMachine
> end
> 
> class StateA < StateMachine
>   has_one :application
> end
> 
> class StateB < StateMachine
>   has_one :application
> end
> 
> The problem is I can get a ScholarshipApplication instance to tell me
> its StateMachine, but the StateMachine can't tell me it's
> ScholarshipApplication.
[...]

Perhaps because you should have your has_one read
has_one :scholarship_application !

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
Posted via http://www.ruby-forum.com/.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to