How can I generate a path or URL in a view in Roda?
Will I need to use a plugin? If not, how else? Or will I have to hard-code urls/paths?
In Rails I'd do this way:
<%= home_about_path %>
How can I generate a path or URL in a view in Roda?
Will I need to use a plugin? If not, how else? Or will I have to hard-code urls/paths?
In Rails I'd do this way:
<%= home_about_path %>
To just generate urls based on set semantics, you want the path plugin.
Usage looks something like this:
App < Roda
plugin :path
path :post do |post|
"/blog/#{post.id}"
end
end
And then, in your templates similarly to how you would use something_path
in Rails:
<a href="<%= post_path(@post) %>" class="btn"><%= @post.title %></a>