how to render a haml subtemplate

103 views
Skip to first unread message

Doug

unread,
Jun 23, 2009, 1:50:28 AM6/23/09
to Haml
I just tried to use a subtemplate to render the login view my main
page.
...both the subtemplate and the current template are haml.

render "user_session/new"
= render "user_session/new.html"
= render "user_session/new.html.haml"

I tried all three; it couldn't find any of them.
ex:
Missing template user_session/_new.html.haml in view path app/views

What am I doing wrong?
...I'm sure it's silly.

thanks,

Bradley Grzesiak

unread,
Jun 23, 2009, 8:24:30 AM6/23/09
to ha...@googlegroups.com
Because it is a subtemplate - or partial - you need a leading
underscore on its filename.

:brad

Doug

unread,
Jun 23, 2009, 3:57:19 PM6/23/09
to Haml
right....I mean't to do this...

render :template => "user_session/new"

but this doesn't work: the page renders but there is no content from
the subtemplate.

and, there's no errors.????

thanks.




On Jun 23, 5:24 am, Bradley Grzesiak <listro...@gmail.com> wrote:
> Because it is a subtemplate - or partial - you need a leading  
> underscore on its filename.
>
> :brad
>

Doug

unread,
Jun 23, 2009, 4:18:51 PM6/23/09
to Haml
I see there is also a render_with_haml method

this produces the same results as above.
If used with :template, no error, but no content.
Otherwise error looking for "_" prefix.

hmmmmm....

Nathan Weizenbaum

unread,
Jun 23, 2009, 11:50:25 PM6/23/09
to ha...@googlegroups.com
Haml doesn't handle finding templates - that's all left up to Rails. I think this is likely a Rails issue.
Reply all
Reply to author
Forward
0 new messages