I have a Ruby on Rails application that was originally set up for Rails API only, however, I need to set up a permalink page through Rails model-view-controller.
I defined a route
get 'posts/:id', :to => 'posts#display'
In posts controller
def display
render "show"
end
In /views/posts/show.html.erb
<p>Hello</p>
When I hit the URL in browser: localhost:3000/posts/1 I would expect to just see the "Hello" rendered from the view
However, I'm just getting a blank text.
From the Rails server log
Started GET "/posts/1" for ::1 at 2022-01-28 18:08:19 -0500
Processing by PostsController#display as HTML
Parameters: {"id"=>"1"}
Completed 200 OK in 2ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 451)
I'm not sure if the assets are not compiling?
Versions:
ruby 2.7.2
rails 6.1.3