Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我做:
params[:page] * 10
它给了我 1111111111。我希望它返回 10。
我究竟做错了什么?
字符串乘法将重复字符串 n 次。params在 Rails中始终是字符串数组,因此您需要params[:page]先将 . 转换为整数to_i。
params
params[:page]
to_i