Witam,
jestem w trakcie nauki ruby i podczas robienia projektu z yt mam problem:
Template is missing
Missing template pages/places/index with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :jbuilder]}. Searched in: * "C:/Users/tomas/desktop/frontend/ruby/publicinternet/app/views" * "C:/Users/tomas/.local/share/gem/ruby/3.2.0/gems/turbo-rails-1.4.0/app/views" * "C:/Users/tomas/.local/share/gem/ruby/3.2.0/gems/actiontext-7.0.6/app/views" * "C:/Users/tomas/.local/share/gem/ruby/3.2.0/gems/actionmailbox-7.0.6/app/views"
Extracted source (around line #3):
1
2
3
4
5
6
class PlacesController < ApplicationController
def index
render "pages/places/index"
end
end
index.html.erb
:
<div>
<h1>List of places to search</h1>
</div>
routes.rb
:
Rails.application.routes.draw do
root "places#index"
end
mój path do index:
app\views\pages\places\index.html.erb
taki kod działa i wyświetla plik no ale to nie jest jako template:
class PlacesController < ApplicationController
def index
render file: 'C:/Users/tomas/desktop/frontend/ruby/publicinternet/app/views/pages/places/index.html.erb'
end
end
dziwne jest to że przy uzyć file znajduję plik a przy samym render już nie. W czym leży problem ?