Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Twitter bootstrap 登录按钮不活动_Twitter Bootstrap_Ruby On Rails 4 - Fatal编程技术网

Twitter bootstrap 登录按钮不活动

Twitter bootstrap 登录按钮不活动,twitter-bootstrap,ruby-on-rails-4,Twitter Bootstrap,Ruby On Rails 4,我将我的表单从使用表单标签更改为使用表单..然后登录按钮无法再提交到用户帐户。。。有人帮我找出问题所在 查看/sessions/new.html.erb <form class="form-horizontal"> <fieldset> <legend>Admin Login</legend> <div class="form-group"> <label for="inputEmail" clas

我将我的表单从使用
表单标签更改为使用表单..然后登录按钮无法再提交到用户帐户。。。有人帮我找出问题所在

查看/sessions/new.html.erb

<form class="form-horizontal">
  <fieldset>
    <legend>Admin Login</legend>
    <div class="form-group">
      <label for="inputEmail" class="col-lg-2 control-label">Email</label>
      <div class="col-lg-10">
        <input class="form-control" id="inputEmail" placeholder="Email" type="text">
      </div>
    </div>
    <div class="form-group">
      <label for="inputPassword" class="col-lg-2 control-label">Password</label>
      <div class="col-lg-10">
        <input class="form-control" id="inputPassword" placeholder="Password" type="password">
      </div>
    </div>
    <div class="form-group">
      <div class="col-lg-10 col-lg-offset-2">
        <button type="submit" class="btn btn-primary">Login</button>
      </div>
    </div>
  </fieldset>
</form>
你必须使用
:save,},{:method=>:post})%>

如果您在erb文件中使用它。rails控制器无法理解普通html表单标记。

如果在erb文件中使用,则必须使用
:save,},{:method=>:post})%>
。您的rails控制器无法理解纯html表单标记。@sandeep可以帮我解释一下{:action=>:save,}的要点,因为我正在使用它,而且我遇到了路由错误。您应该为您的控制器编辑上面的代码。在您的情况下,它看起来像是用于登录的<代码>{:action=>:login,}
@sandeeps谢谢我理解了它…很高兴提供帮助,欢迎使用堆栈溢出。如果此答案或任何其他答案解决了您的问题,请将其标记为已接受
    class SessionsController < ApplicationController
   #skip_before_filter :authorize
  def new
  end

  def create
   user = User.find_by_email(params[:email])
   if user && user.authenticate(params[:password])
    session[:user_id] = user.id
    redirect_to '/'
  else
    redirect_to '/login'
  end
end

  def destroy
    session[:user_id] = nil
    redirect_to '/login'
  end
end
Rails.application.routes.draw do
  root to: 'dashboard#index'

  get '/login' => 'sessions#new'
  post '/login' => 'sessions#create'
  get '/logout' => 'sessions#destroy'

  get '/signup' => 'users#new'
  post '/users' => 'users#create'



  resources :applicants do
    root :to => 'applicants#index'
  end
end