0

I have a view in the LoginController with the following code

def home
  render 'home'
end

However, whenever I load my web server, it shows the error message:

ActionView::MissingTemplate (Missing template login/home, application/home with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :jbuilder]}. Searched in:
  * "C:/Users/60984/prairielearn-eecs/app/views"
  * "C:/Ruby30/lib/ruby/gems/3.0.0/gems/actiontext-6.1.7.2/app/views"
  * "C:/Ruby30/lib/ruby/gems/3.0.0/gems/actionmailbox-6.1.7.2/app/views"
):

app/controllers/login_controller.rb:16:in `home'

Even though I have the file in the directory app/views/login/home.html.erb.

I tried changing it to a more specific directory such as

def home
   render 'login/home'
end

but it still fails. However, I tried using the whole path like

render file: 'C:/Users/.../app/views/login/home.html.erb'

With the code above, the problem changed into the html.erb is not being interpreted, it will display the code blocks on the browser no matter what browser I use.

I am just confused about why it doesn’t work since I have the html file in the designated place.

Jose R
  • 738
  • 2
  • 10
  • 26
  • When you had it set to `render 'login/home'` did you get the exact same error as before? You might want to try `render 'login/home'` again, restart the server, then try viewing it in the browser. If you continue to have trouble, it might be worth double-checking the file path to ensure that it is correct, and that the file name and extension are spelled correctly. – Ecnalyr Feb 18 '23 at 20:12
  • Yes, I tried render 'login/home'. I have the exact same error, I am not sure if this is because I have a window instead of a mac, but when I deploy it to heroku with the add-on postgresql, it seems to work. However, it is still not working for me locally. – confused_person0101 Feb 19 '23 at 06:25

0 Answers0