vendredi 31 juillet 2015

getting No route matches [POST] "/login/log_in"

im using gem parse-ruby-client and im trying to create a login. and when the login is successful then i want to go to a welcome#index

here is my login_controller.rb

class LoginController < ApplicationController
  def index

  end
  def log_in
    @user = Parse::User.authenticate(params[:user][:username], params[:user][:password])
  end
end

index.html.erb

<div class="Log_in_Form">
  <h4><center>Log in with your existing "app_name" account</center></h4>
  <%= form_for(:user, :url => {:controller => 'login', :action => 'log_in'}) do |f| %>
    <center><p> Username:</br> <%= f.text_field :username%> </p></center>
    <center><p> Password:</br> <%= f.password_field :password%></p></center>
    <center><h4><%= f.submit :Login %></h4></center>
  <% end %>
</div>

routes.rb

Rails.application.routes.draw do
  get 'welcome/index'

  root 'login#index'  

  get 'login/log_in' => 'login#log_in'
end

Aucun commentaire:

Enregistrer un commentaire