search for: statea

Displaying 2 results from an estimated 2 matches for "statea".

Did you mean: state
2011 Dec 06
1
making changes to global variables in functions
I'm trying to write a function that takes several objects with many different attributes and then changes their attributes. So what I wanted to happen in the simplified example below is for the function to change the attributes of the objects state1 and state2 that are passed to it. But because stateA and stateB are local, this isn't working. Are there any easy solutions? e.g., if I could combine the two objects stateA and stateB into a single object, I could return it and then assign it back to objects state1 and state2. Or if I could pass a pointer to the original object.. But I cannot fi...
2010 Aug 10
4
(Dreaded) STI, belongs_to
...s 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. E.g.: app = Scholarshi...