Receiving routes does not match [POST] "/ login / log_in"

im using gem parse-ruby-client

and im trying to create a login. and when login is successful I want to go to the greeting # 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

      

+3


source to share


1 answer


you need to have a mail route or your login. change routes to this (if you need a receive route)

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

  root 'login#index'  

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

      

or change



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

      

to

match 'login/log_in' => 'login#log_in', via: [:get, :post]

      

+2


source







All Articles