Rails doesn't seem to be looking for partial in the same directory
I'm working on exercise 3 in Chapter 10 of Michael Hartl's The Ruby on
Rails Tutorial.
I'm refactoring code in app/views/static_pages/home.html.erb and moving it
into the two partials:
1) app/view/static_pages/_signed_in.html.erb and
2) app/view/static_pages/_non_signed_in.html.erb.
and calling render on both files. For some reason I get this error:
ActionView::Template::Error:
Missing partial static_pages/non_signed_in, application/non_signed_in with
{:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw,
:ruby, :jbuilder, :coffee]}.
However, when I move the two partials to the sibling directory
app/view/static_pages/shared and tell render to look there (i.e. "render
'shared/signed_in'" and "render 'shared/non_signed_in'"), the error
disappear. Thoughts?
Thanks!!
No comments:
Post a Comment