title: ActiveResource error handling
body: <p>I have been searching for a while and yet I am not able to find a satisfactory answer as yet. I have two apps. FrontApp and BackApp. FrontApp has an active-resource which mimics a model in BackApp. All the model level validations live in BackApp and I need to handle those BackApp validations in FrontApp.</p>
  
  <p>I have following active-resource code:</p>
  
  <pre><code>class RemoteUser &lt; ActiveResource::Base
    self.site = SITE
    self.format = :json
    self.element_name = "user"
  end
  </code></pre>
  
  <p>This mimics a model which is as follows</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
  
    attr_accessor :username, :password
  
    validates_presence_of :username
    validates_presence_of :password
  end
  </code></pre>
  
  <p>Whenever I create a new RemoteUser in front app; I call .save on it. for example:</p>
  
  <pre><code>user = RemoteSession.new(:username =&gt; "user", :password =&gt; "")
  user.save
  </code></pre>
  
  <p>However, since the password is blank, I need to pass back the errors to FrontApp from BackApp. This is not happening. I just don't understand how to do that successfully. This must be a common integration scenario; but there doesn't seem to be a good documentation for it? </p>
  
  <p>My restful controller that acts as a proxy is as follows:</p>
  
  <pre><code>class UsersController &lt; ActionController::Base
    def create
      respond_to do |format|
        format.json do
          user = User.new(:username =&gt; params[:username], :password =&gt; params[:password])
          if user.save
            render :json =&gt; user
          else
            render :json =&gt; user.errors, :status =&gt; :unprocessable_entity
          end
        end
      end
    end
  end
  </code></pre>
  
  <p>What is it that I am missing? Any help will be much appreciated.</p>
  
  <p>Cheers</p>