Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def is_descendant_of?(other_page)
- return false unless other_page and page
- page == other_page or page.is_descendant_of? other_page
- end
- def is_descendant_of?(other_page)
- return false unless other_page and page
- return true if page == other_page
- page.is_descendant_of? other_page
- end
- def is_descendant_of?(other_page)
- return false unless other_page and page
- if page == other_page
- true
- else
- page.is_descendant_of? other_page
- end
- end
- def is_descendant_of?(other_page)
- parent = page
- while parent
- return true if parent == other_page
- parent = parent.page
- end
- false
- end
Add Comment
Please, Sign In to add comment