lib/nanoc/helpers/link_to.rb in nanoc-2.2.1 vs lib/nanoc/helpers/link_to.rb in nanoc-2.2.2
- old
+ new
@@ -87,10 +87,10 @@
# Find path
path = path_or_rep.is_a?(String) ? path_or_rep : path_or_rep.path
# Get source and destination paths
dst_path = Pathname.new(path)
- src_path = Pathname.new((@page || @asset).path)
+ src_path = Pathname.new((defined?(@page) ? @page : @asset).path)
# Calculate elative path (method depends on whether destination is a
# directory or not).
if src_path.to_s[-1,1] != '/'
relative_path = dst_path.relative_path_from(src_path.dirname).to_s