[Prefix]

What is Prefix

prefix.png

When you execute the rails routes command when checking the routing, a screen like the image above is displayed, but it is the leftmost item in the image above, and what it represents is the item in the middle The routing of the URI pattern of is a variable.

So the description of the transition destination when using the link_to method is as follows

prefix4.png

The place where the URI pattern was described in the routing as

prefix2.png

It can be described with Prefix as follows. The transition destinations are exactly the same for both.

In this case, tweet.id, which is the argument of the prefix called tweet_path, is the routing to the destroy action, so we need information about which tweet to delete, so the id of the corresponding tweet is specified as the argument.

Recommended Posts

[Prefix]
jsp url prefix (memo)