I am new to ruby and I need help.
on my "app\view\home\index" -> localhost I got
<%= link_to "Blog", posts_path %>
that leads me to -> localhost/posts
so far so good. now here is where the problem stats.
on my "app\view\posts\index" -> localhost/posts I got
<%= link_to "Home" %>
That links me to the same page "localhost/posts" but I want it to link to "localhost"
I have tried almost anything but without success.
my routes.rb:
BIO::Application.routes.draw do
root :to => 'home#index'
get "home/index"
resources :posts do
resources :comments end
add root_path to end of link_to
<%= link_to "Home", root_path %>
Use 'rake routes' to see where you can route your application links. And after name of your link try to use ways from this route list, it is more complex then controller/action/id, but real rails way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With