title: Rails validations failing when logged in as admin user
body: <p>I have the following create action in my Rails 3 controller:</p>
  <pre><code>def create
      @registration = Registration.new(params[:registration])
  
      respond_to do |format|
        if @registration.save
          if @registration.orientation != nil #TODO replace this with an online? method
            format.html { render &quot;scheduling_text.html.erb&quot; }
            format.json { render json: @registration, status: :created, location: @registration }
            NsoMailer.registration_email(@registration).deliver
          else
            format.html { render &quot;online_scheduling_text.html.erb&quot; }
            format.json { render json: @registration, status: :created, location: @registration }
            NsoMailer.online_registration_email(@registration).deliver
          end
        else
          format.html { render action: &quot;new&quot; } 
          format.json { render json: @registration.errors, status: :unprocessable_entity } 
        end
      end
    end
  </code></pre>
  <p>I have my own authentication in place, and when I am not logged into the app my validations work as they should. That is to say I make it inside the respond_to block of the code above. However, as an authenticated user if I try and submit this form, my validations fail with this error...</p>
  <pre><code>Started POST &quot;/registrations&quot; for 127.0.0.1 at 2014-06-11 09:52:13 -0400
  Processing by RegistrationsController#create as HTML
    Parameters: {&quot;utf8&quot;=&gt;&quot;✓&quot;, &quot;authenticity_token&quot;=&gt;&quot;PJMFr2FYTYszVndofuZZTaFTmwN8C/41oc6h7ldqfKA=&quot;, &quot;registration&quot;=&gt;{&quot;orientation_id&quot;=&gt;&quot;3&quot;, &quot;first_name&quot;=&gt;&quot;&quot;, &quot;last_name&quot;=&gt;&quot;&quot;, &quot;email&quot;=&gt;&quot;&quot;, &quot;student_id&quot;=&gt;&quot;&quot;, &quot;phone&quot;=&gt;&quot;&quot;, &quot;program&quot;=&gt;&quot;&quot;}, &quot;commit&quot;=&gt;&quot;Register&quot;}
     (0.1ms)  begin transaction
     (0.0ms)  rollback transaction
    Rendered registrations/_form.html.erb (6.4ms)
    User Load (0.1ms)  SELECT &quot;users&quot;.* FROM &quot;users&quot; WHERE &quot;users&quot;.&quot;id&quot; = ? LIMIT 1  [[&quot;id&quot;, 1]]
    Rendered registrations/new.html.erb within layouts/application (8.4ms)
  Completed 500 Internal Server Error in 16ms
  
  ActionController::RoutingError (No route matches {:controller=&gt;&quot;registrations&quot;}):
    app/views/registrations/new.html.erb:9:in `_app_views_registrations_new_html_erb__773571217_97879480'
    app/controllers/registrations_controller.rb:64:in `block (2 levels) in create'
    app/controllers/registrations_controller.rb:52:in `create'
  
  
    Rendered /home/johnmlocklear/.rvm/gems/ruby-1.9.3-p374/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.5ms)
  </code></pre>
  <p>This seems to has something to do with routing? Just as an aside my routes look like...</p>
  <pre><code>/orientations/3/registrations/new
  </code></pre>
  <p>when the form initially loads, and after validation fails the route is...</p>
  <pre><code>/registrations
  </code></pre>
  <p>...with hidden values for the orientation_id. Not sure what that would have to do with a user be logged in. Also notice in the error there is a line that reloads the user. I don't see that when I'm not logged in, so that could also be part of the issue.</p>
  <p>Any help appreciated!</p>
  <h1>EDIT</h1>
  <p>here is app/views/registrations/new.html.erb</p>
  <pre><code>&lt;h1&gt;Register for New Student Orientation&lt;/h1&gt;
  
  &lt;%= render 'form' %&gt;
  
  &lt;%= link_to 'Back', orientations_path %&gt;
  
  &lt;% if current_user %&gt;
    &lt;/br&gt;
    &lt;%= link_to 'View Registrations', orientation_registrations_path %&gt;
  &lt;%end%&gt;
  </code></pre>
  <p>Here is the orientation_registrations routes...</p>
  <pre><code>orientation_registrations GET    /orientations/:orientation_id/registrations(.:format)          registrations#index
                            POST   /orientations/:orientation_id/registrations(.:format)          registrations#create
  </code></pre>