prismicio/ruby-kit — pull request #9 by rudyrigot (2013-11-28 02:15:57+00:00)
Title: getting link_resolver to work on a document

Trying to do this in a view (`@questions` is an array of `Prismic::Document` objects):
```
<% @questions.each do |question| %>
<%= link_to "See the question", link_resolver(@ref).link_to(question) %>
<% end %>
```

Of course, this doesn't work, since LinkResolver.link_to takes a `DocumentLink`. Solutions: transforming it into a `DocumentLink` before passing it (meh), or redeveloping here the URL writing for questions, which I already wrote in my `link_resolver` helper method (meh, will have to change it on both places if my URLs change).

So, I'm thinking: maybe `link_to` should be able to handle `DocumentLink` and `Document` objects, so that we can do that? I developed it, and it works, but I'm not sure it's a behaviour we want for `link_resolver`; what do you think?