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?

デザインの指定についてとuser_path(user)について

Posted at

class→デザインを指定するためのシール

具体例
one-postだと後でscssでデザインを設定する
cardだとbootstrapで指定されているデザインにする
mt-3だと余白を上に作るよというbootstrapで指定されているclass

<%= link_to user_path(user) do %>

まず前提としてrailsでは、各userにidが設定されている。
学校のクラスで例えるなら、userが生徒で、idが出席番号。

また、urlを作る際には、
「/users/:id」の形で作成されるようになっている。
userには番号が付与されている。

link_toで「行き方、ルートを作って!」と指示する!
user_pathでuserからidをくり抜いて、さっきのurlの型に埋め込んでurlが完成する!
例えるなら、
userがクッキーの生地、user_pathが型抜きでクッキー生地をくり抜いて、ほしいところだけ抽出してケーキに飾り付けするみたいな感じ!

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?