In my Ruby on Rails application
I have a page Aboutus - This has a Controller and View. Has no model.
I have a Comments model (generated by the rails generate scaffold
comment) - This has a Controller, view, model
On my Aboutus page, I want to show the “Comments” from the comments
model, so I am thinking of using the Comments index action (to list
comments) and new action (to create new comments) on my Aboutus page.
I am having trouble getting this right.
This is what I did: Aboutus controller, I added
redirect_to :controller => “comments”, :action => “index”
Aboutus views, I added
<%= render ‘comments/index’ %>
It doesnt work, gives me Undefined redirect_to and nil object @comments
errors. Could you advise me
- A proper way to do this
- Any thing to do to config.rb ?