Q:

can't direct manual login away from sessions#create

Running Ruby 1.9.3p545 rails 4.1.4
I have an application where users canlogin through facebook, twitter, etc and can rehister manually. I would like a logon process for those who have registered manually.
Routes are
         get 'auth/:provider/callback', to: 'sessions#create'
     get 'auth/failure', to: redirect('/')

     get 'signout', to: 'sessions#destroy', as: 'signout'

     get "sign_up" => "profiles#new", :as => "sign_up"

     get "log_in" => "logins#new"

     post "log_in" => "logins#login"

Everything works fine except the manual logi. logins.new presents a form ok bu the subsequent submit always ends up in sessions controller at create.
I defined a login controller and tried to use the above post in the routes to get it away from the omniauth process in sessions#create.
The login form is
        Log in
    <%= form_tag sessions_path do %>
   <p>
    <%= label_tag :email %><br />
    <%= text_field_tag :email, params[:email] %>
   </p>
   <p>
   <%= label_tag :password %><br />
   <%= password_field_tag :password %>
  </p>
  <p class="button">
  <%= submit_tag "Sign in" %>
  </p>
  <% end %>

logins#login is
 def login

    authorized_user = Profile.authenticate(params[:name_or_email],params[:password])

   if authorized_user

     flash[:notice] = "Wow Welcome again, you logged in as #{authorized_user.username}"

     redirect_to(:action => 'home')

   else

     flash[:notice] = "Invalid Username or Password"

     flash[:color]= "invalid"

    render "login"  

   end

Is tehre any way I can direct the submit of the login form away from the sessions controller?
Thanks in advance
    end

A:

The line
<%= form_tag sessions_path do %>

is what's throwing things off.  It makes the form post to sessions_path.  Try replacing it with <%= form_tag log_in_path do %>, or, better, yet, replace it with <%= form_tag "" do %> since the default is to post to the same URL as the current page.
Some more clarification:
<%= form_tag sessions_path do %>

generates the following HTML (roughly, skipping some details that aren't relevant to this issue):
<form action="/sessions" method="post">

since /sessions is the path to sessions#create.  You want the action to be /log_in, i.e. the path to logins#login, so you want to change the argument you're passing to form_tag.
Since you're already on the page log_in, if you leave the action blank, i.e.:
<form method="post">

it will get you where you want, since the default behavior of the browser is to post to the same page.

