New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
url helper to generate absolute URL #751
Comments
yeah, I'm working on this now. |
Great, thanks! |
any progress? |
That would be a really useful feature. |
Is this issue abandoned? |
You can use: uri url(:controller, :action, :param => value) @nesquena can you improve a guide with this? |
Sure, good idea |
GOD. Thanks, that solves the problem. |
It's actually part of sinatra: http://rubydoc.info/github/sinatra/sinatra/Sinatra/Helpers#uri-instance_method |
Hmmmm, I got it. |
how about using : only_path option, that is a rails style option for url_for :http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-url_for |
What ended up being the outcome of this? I am having trouble finding the appropriate solution in the guides. How does one generate an absolute URL in padrino? |
Don't know if any additional work has been done with this, but I just coded my own helper method in the meantime: class MyApp < Padrino::Application
configure :development do
set :host, "http://localhost:3112"
end
def self.abs_url_for(*args)
settings.host + url(*args)
end
end Use in views like My two cents: felt kinda misleading coming over from Rails with this, as I would've expected |
@neezer +1 |
Why don't we add that helper and if the setting |
@padrino/core-members thoughts? |
And then, one year later, I'm back in the same issue, trying to create an absolute URL inside a controller's method - to be used with a payment gateway. Looks like I'm trying to require the needed Sinatra files, but to no avail as well - I think I'm just too rusty with Ruby, after all. Would there be a better way to do this? App.controller :cart do |cart|
def cart.do_stuff
uri url(:cart, :success)
end
post :checkout do
redirect_to cart.do_stuff
end
end |
fix #751, introduce #absolute_url for generating absolute urls
Currently the URL helper generates relative URLs. Is there a way to generate a fully qualified URL?
The text was updated successfully, but these errors were encountered: