简体   繁体   中英

Passing has value from view to controller in rails

Hey guyz I want to pass a value from view with will_paginate and want to access this value in controller as params[:user][:id]. How will I do it?

Ok, so you want to do:

<%= will_paginate @user_rep, params: { start_date: @start_date, end_date: @end_date, user: @user.attributes.to_hash } %>

or if you want to do it by hand

<%= will_paginate @user_rep, params: { start_date: @start_date, end_date: @end_date, user: { id: @user_id } } %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM