Scott Eade
2006-Jan-23 23:38 UTC
[Rails] ssl_requirement plugin: how do I override ssl_required?
The ssl_requirement plugin indicates that I can override the ssl_required? method. I want to use this facility to ignore the ssl requirement declarations when RAILS_ENV is anything other than ''production''. My question is, where do I override this? The relevant readme is: http://dev.rubyonrails.org/browser/plugins/ssl_requirement/README Also, does this plugin work with a WEBrick based development environment running on port 3000? It looks like it is totally dropping the port from the url. TIA, Scott -- Posted via http://www.ruby-forum.com/.
Jamis Buck
2006-Jan-24 00:12 UTC
[Rails] ssl_requirement plugin: how do I override ssl_required?
On Jan 23, 2006, at 4:37 PM, Scott Eade wrote:> The ssl_requirement plugin indicates that I can override the > ssl_required? method. I want to use this facility to ignore the ssl > requirement declarations when RAILS_ENV is anything other than > ''production''. > > My question is, where do I override this?You could do it in your ApplicationController: class ApplicationController < ActiveRecord::Base include SslRequirement alias :original_ssl_required? :ssl_required? def ssl_required? my_custom_condition_met? || original_ssl_required? end end> > The relevant readme is: > http://dev.rubyonrails.org/browser/plugins/ssl_requirement/README > > Also, does this plugin work with a WEBrick based development > environment > running on port 3000? It looks like it is totally dropping the port > from the url.The SSL redirects assume that https maps to port 443. You would need to have a webrick running on port 3000 and port 443 (with port 443 being the secure port). - Jamis