So here is my dilemma. I have created a rails scaffold named posts for a blog I am working on. What I want to be able to do is to display posts on the homepage. If anyone has any info or can point me towards a tutorial, I would very much appreciate it.
Share
In your routes, wherever you have :root pointing to, you can set your posts to @posts in the controller method, then iterate over them in the view. In other words:
Config/routes.rb
This means your “home page” points to the home method in pages controller. So:
app/controllers/pages_controller.rb
Then in app/views/pages/home.html.erb
Hope this helps!