开发者

hyperlink in ruby on rails

开发者 https://www.devze.com 2022-12-12 00:24 出处:网络
This is something probab开发者_C百科ly trivial but i can\'t quite find my way round it: How do i add a hyperlink from one ruby-file.html.erb to another please? Ruby uses something called routes. You

This is something probab开发者_C百科ly trivial but i can't quite find my way round it:

How do i add a hyperlink from one ruby-file.html.erb to another please?


Ruby uses something called routes. You can create named routes for some operations or you can use resource routes (autogenerated CRUD per resource).

For example if you have route for a model called Car, then calling

link_to "Edit my car", edit_car_path(@car)

in your view will generate a link.

remember that your are linking to a controller action in model/view/controller and not to pages

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号