rails4 在页面view用link_to 给控制器controller传参数

来源:互联网 发布:网络对战射击游戏 编辑:程序博客网 时间:2024/06/06 09:27

app\views\productions\index.html.erb  部分代码

<%= link_to '#veg',productions_index_path(:protype => 'V') %>

app\controllers\productions_controller.rb    部分代码

  def index      unless params[:protype].blank?      @products=Production.where(pro_type: params[:protype])    else      @products = Production.where(pro_type: 'T')    end      end



0 0
原创粉丝点击