title: method_missing and association_proxy in rails
body: <p>So, here's my problem. I currently am building a simple authentication system for a rails site. I have 3 classes for this: Person, Session, and Role. In my Person model I have defined <code>method_missing</code> to dynamically capture roles according to <a href="http://metautonomo.us/2008/09/30/easy-role-based-authorization/" rel="nofollow noreferrer">this guide</a>.</p>
  
  <p>In my application_controller I have some logic to deal with logins and log-outs, the result of which gives me the currently logged in user via:
      <code>@user = @application_session.person</code>
  Where <code>@application_session</code> is the current session</p>
  
  <p>Now in one of my controllers, I don't want anyone to be able to do anything unless they are an admin, so I included:
      <code>before_filter @user.is_an_admin?</code></p>
  
  <p>This raises a <code>NoMethodError</code>, even though I have <code>method_missing</code> defined in my model. I tried defining <code>is_an_admin?</code>, having it always return true as a test, and that works.</p>
  
  <p>According to <a href="https://stackoverflow.com/questions/3386567/method-missing-override-is-not-working">this question</a>, I think the problem might have something to do with proxy associations. When I run:
      <code>puts @user.proxy_owner</code>
  I get a session object, since each user (Person) can have many sessions, and I got my user (Person) from the current session.</p>
  
  <p>I am very confused why <code>@user.is_an_admin?</code> is not calling the method_missing method in my Person controller. Please let me know if you need more information or code snippets.</p>
  
  <p>I am using Rails 3 on Ruby 1.9</p>