I wish to do a redirection to index.html in my application/public folder.
def get_current_user
@current_user = current_user
if @current_user.nil?
redirect_to root_path
end
end
How do I achieve this ?
I haven’t modified the root in my routes.rb ( Its still commented )
# root :to => "welcome#index"
I get an error saying root_path is undefined.
How do I modify routes.rb so that root_path points to public/index.html ?
What you want to do is not Rails compatible.
Rails is MVC, C for controller, V for view.
So its internals need both.
Ok,
public/index.htmlis displayed by default but it’s just because process is bypassed.So, you could create a
staticcontroller with anindexaction and it’s corresponding view (just copy/paste the content of your currentpublic/index.htmlfile in it).Then set:
And please, remove the
public/index.htmlfile 🙂