The "a href" works as planned but the "Link_to" is adding an "id" to the end of the "hello" action directing me to demo/helloid instead of demo/hello. See Rails .erb code below
<h1>Demo#index</h1>
<p>Hello From index!!</p>
<a href="/demo/hello">Hello page 1</a><br />
<%= link_to "Hello Page 2", ({ controller: "demo", action: "hello"}) %>
While looking in at the HTML source it presents the following
<h1>Demo#index</h1>
<p>Hello From index!!</p>
<a href="/demo/hello">Hello page 1</a><br />
<a href="/demo/helloid">Hello Page 2</a>
Routes
Rails.application.routes.draw do
root "demo#index"
#get 'demo/index'
match ':controller(/:action(id))', :via => :get
Controller
class DemoController < ApplicationController
layout false
def index
end
def hello
#render('hello')
@array = [1,2,3,4,5]
end
def other_hello
redirect_to(:controller => 'demo', :action => 'index')
end
end
routes.rb
and controller code? – Kkulikovskislink_to "Profile", { controller: "profiles", action: "show", id: @profile}
– Amit Sharma