Custom layouts and root directory

41 views
Skip to first unread message

Olivier S

unread,
Jan 17, 2015, 1:46:41 PM1/17/15
to public-...@googlegroups.com
Hello,
I need to have multiple layouts for PA and templates. I am using the default layout and templates for one usage, and I created another layout with different templates for my other usage.

<%= render_activities(@activities, :layout => '/activities/layout') %>

renders my activities with the correct (i.e. custom) layout but uses the default templates (in /views/public_activity/).

<%= render_activities(@activities, :root => '/activities/activity-log') %>

renders my activities with the default layout but uses my custom templates (in /views/activities/activity-log/).

However, I cannot combine both the root template and root layout :

<%=  render_activities(@activities, :layout => 'layouts/activity', :root => '/activities/activity-log') %>

renders the correct layout but ignores my custom templates.

Am I using the wrong syntax ?

Thanks

Olivier S

unread,
Jan 17, 2015, 2:52:13 PM1/17/15
to public-...@googlegroups.com
Got it.

This is  /views/activities/activity_report.html.erb
<%= render_activities @activities, :layout => '/activities/layout' %>

and in my /views/activities/_layout.html.erb
<%= render_activity activity, :root => '/activities/activity-log' %>
Reply all
Reply to author
Forward
0 new messages