Displaying 20 results from an estimated 22 matches for "host_with_port".
2009 Nov 11
4
host_with_port in config/environment.rb
...everyone... i''m Italian, sorry for my poor English, but I find
myself in difficulties with this method.I don''t need to redirect the
logout of rubycas in a host other than localhost... when the decoy in
"config/environment.rb" of course tells me ''method ''host_with_port''
undefined''... I looked in the folder of ruby and i saw that it is
defined in
Ruby\lib\ruby\gems\1.8\gems\actionpack-2.3.4\lib\action_controller\request.rb,
then to invoke it I did the following:
require ''actionpack''
ActionController.host_with_port
and gives...
2007 Nov 06
1
[PATCH] ActionController::CgiRequest#host_with_port() should handle standard port
Hi everyone,
I''m looking for some +1''s for a bug fix patch I submitted:
http://dev.rubyonrails.org/ticket/10082
The problem is that CgiRequest#host_with_port() overrides
AbstractRequest#host_with_port() and does''nt use port_string()
with standard_port() care.
So I created patch to rename CgiRequest#host_with_port() to
host_with_port_without_standard_port_handling().
And then CgiRequest#host_with_port() is inherited AbstractRequest''s...
2008 Apr 20
2
open_id_authentication - authenticate_with_open_id
....rb:
86:in `authenticate_with_open_id''
app/controllers/account_controller.rb:33:in `open_id_authentication''
app/controllers/account_controller.rb:12:in `create''
It seems to be failing here, but I have no idea why...
def requested_url
"#{request.protocol + request.host_with_port +
request.relative_url_root + request.path}"
end
I''ve tested to ensure that "username.myopenid.com" is being passed as
the openid_url parameter. Am I missing something else?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are sub...
2010 Dec 01
10
How to Redirect from http://mysite.com to https://www.mysite.com on Herok
Hello I''m looking to learn how to redirect all non-www (mysite.com) to
https://www.mysite.com
I tried the following:
class ApplicationController < ActionController::Base
before_filter :check_uri
def check_uri
redirect_to request.protocol + "www." + request.host_with_port +
request.request_uri if !/^www/.match(request.host) if Rails.env ==
''production''
end
Problem with this is since the SSL cert on Heroku is for www.mysite.com,
and not mysite.com, the browser throws the nasty SSL HTTPS invalid
warning.
Any ideas on how to redirect in a way tha...
2006 Jan 23
2
Action Cache upgrade plugin
...K'' response from subsequent requests)
5. Allow clients to provide their own implementation of the cache key
for the actions, e.g.
- environment.rb
ActionController::Caching::Actions::ActionCacheFilter.fragment_key =
Proc.new {|controller|
"AC:#{controller.request.host_with_port}:#{controller.params.sort.join(''
:'').gsub('' '', ''-'')}"
}
6. Allow an action to specify a Time To Live for the cached item. Set
''response.time_to_live'' to
the number of seconds before this cached item will b...
2008 Jun 13
1
asset_host and ssl pages problem
...nd a bit and found this
bit of code which should when a page is https:// serve the assests from
the app server and when it is not https serve the assets from the assets
server.
ActionController::Base.asset_host = Proc.new { |source, request|
if request.ssl?
"#{request.protocol}#{request.host_with_port}" # Disable asset
hosting.
else
"#{request.protocol}assets1.example.com" # Use asset host.
end
}
but i always get this error when navigating to any page
Showing layouts/admin.html.erb where line #8 raised:
You have a nil object when you didn''t expect it!
The error...
2010 Jan 09
5
Redirect 301 and cache
...o WWW domain (for example
if I enter example.com/test to redirect to www.example.com/test). I
put the following code in the application controller and worked fine:
before_filter :check_uri
def check_uri
if !/^www/.match(request.host)
redirect_to request.protocol + "www." + request.host_with_port +
request.request_uri, :status => 301
end
end
But I also do a simple pages_cache and the above code doesn''t execute
when the page is cache. Is any other way to call the above method from
route.rb even when the pages are cached?
Thank you
--
You received this message because you...
2011 Sep 02
1
can't compile assets on prod due to asset_host config && SSL requirement
My production asset_host config looks like this:
config.action_controller.asset_host = Proc.new { |source, request|
if request.ssl?
"#{request.protocol}#{request.host_with_port}"
else
"#{request.protocol}assets#{(source.length % 4) +
1}.example.com"
end
}
...which is more or less straight from the docs:
http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html
When I go to assets:precompile, I get this:
$ RAILS_ENV=produc...
2009 Jan 09
6
Accessing request.host in UserMailer
I am using subdomains in my application to control context. Therefor,
during user registration, password reset, and other actions that require
an email to be sent with a link to be clicked, I need to ensure that the
subdomain appropriate for the user is used.
It seems I need to be able to access request.host from within an
ActionMailer model. But I am not clear how to do this.
Any help would be
2007 Dec 23
1
Rails: possible routing discrepancy
..._helper.rb, in
current_page?, which is used by link_to_unless_current. Here''s that
method:
def current_page?(options)
url_string = CGI.escapeHTML(url_for(options))
request = @controller.request
if url_string =~ /^\w+:\/\//
url_string == "#{request.protocol}#{request.host_with_port}#
{request.request_uri}"
else
url_string == request.request_uri
end
end
So here''s the rub: When I''m running current_page? with script/server,
I get "/writing" for url_string and "/writing" for
@controller.request.request_uri -- meaning cur...
2006 Apr 24
7
Controller can''t find helper?????!!!!!????
I have a controller named xyzController under app/controllers
I have a helper class named xyzHelper under app/helpers.
Shouldn''t I be able to call methods from xyzHelper inside of
xyzController without any problems?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
2009 Nov 10
10
Un-recognised routes that do exist, using namespaces & subdomain checking
I''m getting really cheesed off with RSpec not matching some of my
routes when controller testing when I have subdomain checking
(courtesy of subdomain-fu) on namespaces. These routes appear in the
rake routes output, and work fine via HTTP requests .
The really annoying thing is it''s working fine for routes that aren''t
at the root of the namespace.
E.g. say I have
2007 Apr 22
7
Getting a complete URL from Rails
Hello,
I''m sending out an e-mail message to new users of my service. I want
to send a particular link in this e-mail but I can''t figure out how to
get a complete URL from the url_for method. Is there a way to do this
without manually setting the host name?
Thank you,
-- Miles
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are
2006 May 01
0
Obtaining the name of the host in environment.rb
...erent PCs. In the
environment.rb file , we would like to set a constant to the name and
port of the host. Is there a function that we can call to obtain the
host and port when called from environment.rb?
Ideally we want something like
SVR=host_and_port()
Remember, we cannot use ActionController#host_with_port because we are
not in an action.
Thanks,
Yash
--
Posted via http://www.ruby-forum.com/.
2006 May 03
2
issue in uploading images
...uot;
/public/images/#{@params[''picture''].original_filename}", "w") { |f|
f.write(@params["picture"].read) }
redirect_to :controller => ''admin'', :action => "new1",
:bildpfad=> @request.protocol + @request.host_with_port + "
/images/#{@params[''picture''].original_filename}"
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060503/566aea69/attachment.html
2006 Mar 13
1
issue with redirect_to
...logger.info("Redirected to #{options}") unless
logger.nil?
757: response.redirect(options)
758: response.redirected_to = options
759: @performed_redirect = true
760:
761: when String
762: redirect_to(request.protocol + request.host_with_port
+ options)
763:
764: when :back
765: redirect_to(request.env["HTTP_REFERER"])
766:
767: else
768: if parameters_for_method_reference.empty?
769: redirect_to(url_for(options))
770: response.redirected_to = options
771:...
2010 Mar 02
1
localized host in ActionMailer Views
Hi,
I''ve got some domains , lets say example.com and example.de and I want
that the link in a ActionMailerView contains the correct localized
host e.g. with <%= @root_url %> .
Currently the host is set in the environment.rb with
"config.action_mailer.default_url_options = { :host =>
"example.com" }".
How can I set the host dynamically and localized?
2006 Apr 17
8
file upload
This is probably me having an issue with the mvc way of living.. .I''m
used to perl/php scripting...
I''ve got a photo blog I''m making... and in past iterations of this
website, I''d just name the photos after the id of the entry. For
instance:
/photos/id.jpg
/photos/id_thumb.jpg
However, I''m having trouble finding an easy way to do this with rails.
2007 Feb 08
2
cannot set ENV['RAILS_RELATIVE_URL_ROOT']
i am on lighttpd now, and i cannot set
cannot set enviroment variable:
i added this line to enviroment.rb, but it doesn not work!!
ENV[''RAILS_RELATIVE_URL_ROOT''] = ''something''
links on my page are ok, but all links to images, stylesheets etc are
broken, (because relative_url_root returns ''''), what else can I do?
thanks. f.
--
Posted via
2007 Dec 20
0
Relative URL fix
...ly, rewrite_url cares about the existence of the key not
only its'' value.
def rewrite_url(path, options)
url = old_rewrite_url(path, options)
if ActionController::check_mode_and_base
unless options[:skip_relative_url_root]
url = url.gsub(@request.protocol + @request.host_with_port, '''')
url = BASE_URL + url
end
end
url
end
Here is a slight change to the rewrite_url_with_facebooker method,
which deletes the :skip_relative_url_root key if it is true.
def rewrite_url_with_facebooker(*args)
options = args.first.is_a?(Hash) ? args.f...