I wish to know what's the (user)
for. I am having trouble understanding rails routing system.
Is user_path(@user)
the same as user_path(user)
?
That is the arguments you give to the user_path method when you call it. Since the path generated is something like /user/25 the object user points to is used to get that ID number.
@user is an instance variable, usually set in the controller (Rails copies these into the View before rendering the Erb template), whereas user is either a local variable or a method call, perhaps given as explicit local variable in the render call or defined as a method in your ApplicationHelper module.
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.