Erika
Erika

Reputation: 2065

hyperlink in ruby on rails

This is something probably 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?

Upvotes: 1

Views: 2453

Answers (1)

Zepplock
Zepplock

Reputation: 29175

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

Upvotes: 4

Related Questions