I'm trying to run some code on a controller in Volt, but only on certain pages. I've looked through the docs, but I'm not really sure how to get access to a given page's URL. Is there perhaps some hidden variable or something in the page model, like so?:
module Main
  class MyController < Volt::ModelController
    model :page
    def index
    end
    def template_page
      if page.url == "/foo/bar" # obviously, this doesn't actually work
        # run some code
      end
    end
  end
end
 
                        
If you are using bindings in your URL, for example
you can access those in the controller via the params collection:
In other cases you URL should be static anyway.