Can you easily add all methods behind the ssl_required instead of having to add them one by one? Like ssl_required :all -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You can define a protected method in your controller, which will make every action in this controller and all its subclasses only available through ssl: def ssl_required? true end izidor On 5.9.2008, at 16:29, Pål Bergström wrote:> > Can you easily add all methods behind the ssl_required instead of > having > to add them one by one? Like ssl_required :all > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Izidor Jerebic wrote:> You can define a protected method in your controller, which will make > every action in this controller and all its subclasses only available > through ssl: > > def ssl_required? > true > end > > > izidor > > > On 5.9.2008, at 16:29, P�l Bergstr�m wrote:Thanks :-) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m concerned this may not be the best way to go. in my /app/controllers/application.rb file i''ve added def ssl_required? return false if ENV[''RAILS_ENV''] == true end So that I can still run my application on webrick without https in development mode. But, when I want ssl_required to work on all my controllers and utilize the method below, my ssl_required? method in the application helper doesn''t function as intended. the ssl_required in the individual controller takes precedence. it is too bad one can''t just add ssl_required :all Does anyone know how to solve both problems in the best way possible? Thank you! Pål Bergström wrote:> Izidor Jerebic wrote: >> You can define a protected method in your controller, which will make >> every action in this controller and all its subclasses only available >> through ssl: >> >> def ssl_required? >> true >> end >> >> >> izidor >> >> >> On 5.9.2008, at 16:29, P�l Bergstr�m wrote: > > Thanks :-)-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
class SecureAreaController < ApplicationController protected def ssl_required? Rails.env.production? end end class CreditCardController < SecureAreaController ... end -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ryan, If you are using or can use passenger to serve your production env, then an alternative that would make this a non-issue would be to use passenger to serve your development env as well. That way you''d be able to use ssl in dev env just as you would in prod env. Another benefit would be that you''d also be able to test your prod env setup (ie subdomain, virtual-host, passenger/web-server, etc) by having a similar setup for your dev env. Jeff On Mar 26, 11:28 am, Robert Head <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> class SecureAreaController < ApplicationController > > protected > > def ssl_required? > Rails.env.production? > end > > end > > class CreditCardController < SecureAreaController > > ... > > end > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I found this fork of ssl_required that solves this problem, but I haven''t tried it yet: http://github.com/bcurren/ssl_requirement Ryan Wilson wrote:> it is too bad one can''t just add > > ssl_required :all > > > Does anyone know how to solve both problems in the best way possible? > > Thank you!-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.