I am new to rails and I have used
redirect_to :controller => “posts”, :action => “index”
in controller and now I can use this in my views. When using it in views it shows
NoMethodError in Home#index
Showing
/Users/#####/RubyProjects/devise_example/app/views/home/index.html.erb
where line #9 raised:undefined method `redirect_to’
How can I get the index of post from home index?
Why would you want to redirect in your view ? The redirection has to be done in the controller.
If you want to make a link to posts#index use this
<%= link_to "Posts", posts_path %>