Ruby on rails 它不会重定向到show方法
history s_controller.rbRuby on rails 它不会重定向到show方法,ruby-on-rails,ruby,Ruby On Rails,Ruby,history s_controller.rb class Facturacion::HistorysController < Facturacion::AuthorizeController #before_filter :student, :only => :show,:index skip_load_and_authorize_resource authorize_resource :only => [:index, :show] layout 'facturacio
class Facturacion::HistorysController < Facturacion::AuthorizeController
#before_filter :student, :only => :show,:index
skip_load_and_authorize_resource
authorize_resource :only => [:index, :show]
layout 'facturacion/dashboard_layout'
def index
# id=params[:filter][:student]
end
def show
puts "im here"
ids=params[:student].to_i
print ids
# puts ids
@user =Academico::Student.find(params[:id])
end
private
def historys_params
params.require(:facturacion_history).permit(:student=>[:id])
end
resources :statements
resources :historys
<div class="right_col" role="main">
<div class="">
<div class="clearfix"></div>
<div class="row">
<div class="clearfix"></div>
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Historial Transacciones</h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<% if notice.present?%>
<div class="alert alert-success">
<a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a>
<%= notice %>
</div>
<% end %>
<div class="table-responsive">
<div class="item form-group">
<%= form_tag facturacion_historys_path, :method => 'get',:class=>"form-horizontal form-label-left" do %>
<%= label_tag "Estudiante", nil, :class=>"control-label col-md-3 col-sm-3 col-xs-12" %>
<div class="col-md-6 col-sm-6 col-xs-12">
<%= collection_select(:student,:id, Academico::Student.all, :id,:full_name, {:include_blank => true, :required=>"required"},{:class=>"select2_single form-control",:required=>"required"}) %>
</div>
</div>
<div class="clearfix"></div>
<br>
<div class="clearfix"><br></div>
<div class="form-group">
<div class="row">
<div class="col-md-3" style="margin-left:100px;">
</div>
<div class="col-md-3" style="margin-left:100px;">
<button id="send" type="submit" class="btn btn-success">Generar</button>
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
</div>
index.html.erb
class Facturacion::HistorysController < Facturacion::AuthorizeController
#before_filter :student, :only => :show,:index
skip_load_and_authorize_resource
authorize_resource :only => [:index, :show]
layout 'facturacion/dashboard_layout'
def index
# id=params[:filter][:student]
end
def show
puts "im here"
ids=params[:student].to_i
print ids
# puts ids
@user =Academico::Student.find(params[:id])
end
private
def historys_params
params.require(:facturacion_history).permit(:student=>[:id])
end
resources :statements
resources :historys
<div class="right_col" role="main">
<div class="">
<div class="clearfix"></div>
<div class="row">
<div class="clearfix"></div>
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Historial Transacciones</h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<% if notice.present?%>
<div class="alert alert-success">
<a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a>
<%= notice %>
</div>
<% end %>
<div class="table-responsive">
<div class="item form-group">
<%= form_tag facturacion_historys_path, :method => 'get',:class=>"form-horizontal form-label-left" do %>
<%= label_tag "Estudiante", nil, :class=>"control-label col-md-3 col-sm-3 col-xs-12" %>
<div class="col-md-6 col-sm-6 col-xs-12">
<%= collection_select(:student,:id, Academico::Student.all, :id,:full_name, {:include_blank => true, :required=>"required"},{:class=>"select2_single form-control",:required=>"required"}) %>
</div>
</div>
<div class="clearfix"></div>
<br>
<div class="clearfix"><br></div>
<div class="form-group">
<div class="row">
<div class="col-md-3" style="margin-left:100px;">
</div>
<div class="col-md-3" style="margin-left:100px;">
<button id="send" type="submit" class="btn btn-success">Generar</button>
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div>
</div>
我不知道我做错了什么,或者如果我在做什么,或者我在做什么,我将非常感谢您的帮助,非常感谢您在index.html中的表单,您需要正确的路径
/facturacion/history/:id
即事实历史路径(:id)路径中有一个输入错误
注意:您还需要添加记录的id。表单路径中有一个打字错误
facturacion\u history路径
,而不是facturacion\u history\u路径
(s)