title: Use attr_accessor to return navigation field value
body: <p>I have a belongs_to relation in my Patient model, then I need to create an attr_accessor to read the state_id from the city specified in the Patient object. </p>
  
  <p>How can I do this? </p>
  
  <p>If I just use attr_accessor :state_id, I'd have to set it in the class initialization and the value would be static. I need it to be read only and updated automatically according to the current value of City navigation property. </p>