0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Railsで複数のパラメーター(params)を追加するには?

Posted at

リンク先の同一のページで表示内容をリンク元ごとに変えたい時

<%= link_to "カレンダーで投稿をみる","/posts/#{current_user.id}/index?start_date=#{Date.today.strftime("%Y-%m-%d")}&post_index=0"%>

上記では、params[:start_date]とparams[:post_index]でそれぞれDate.today.strftime("%Y-%m-%d")と"0"という値を受け取れる!

元々のURLの後に"?"で"パラメータ名=値"、複数ならば、その後に"&"と"パラメータ名=値"を続ければよし!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?