Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ChildParent helper #849

merged 2 commits into from Apr 17, 2016

Add ChildParent helper #849

merged 2 commits into from Apr 17, 2016


Copy link

@ddfreyne ddfreyne commented Apr 17, 2016

This adds #children_of and #parent_of, which works with both legacy and full identifiers. For example:

<%= link_to(parent_of(@item)) %>
<% children_of(@item).each do |child| %>
  <li><%= link_to(child[:title], child) %></li>
<% end %>

This allows getting rid of the ugly piece of upgrade advice that tells people to replace @item.parent with @items[@item.identifier.to_s.sub(/[^\/]+$/, '').chop + '.*'].

@ddfreyne ddfreyne added this to the 4.2 milestone Apr 17, 2016
@ddfreyne ddfreyne force-pushed the child-parent-helper branch from 95f5e1c to 4458be2 Apr 17, 2016
@ddfreyne ddfreyne merged commit 5935762 into master Apr 17, 2016
1 check passed
@ddfreyne ddfreyne deleted the child-parent-helper branch Apr 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant