The controller classes are cached in production, so you
can't have
declarations there that are conditional to a single
request.
Also, if you are using RESTful routing, what you are trying
to
accomplish won't work very well anyway, because ssl_required
performs
a redirect, and if you are posting a new form, it will be
lost in the
redirect.
My advice, just make the create method always SSL (and the
:new method
too so people don't see a secure submission from an insecure
page
warning). If for some reason you really need one secure and
one not,
add a :secure_create method and split them up.
On Feb 23, 2008, at 6:22 PM, Jerry Liu wrote:
>
> I want to perform certain action in controller based on
request
> parameters. Is there some way to access params in
controller before a
> real action? Like in following code:
>
> class UsersController < ApplicationController
>
> # params[:type] in here does not work
> ssl_required :create if
params[:type]=="something"
>
> def create
> # params[:type] works in here.
> end
> end
>
> If not, what's the best way to do this?
> --
> 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 googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---
|