How to set some variables on bootstap? I need a few variables to be
initialized with default values every request. For example in ZF there
is a class Bootstrap whose methods are called automatically every
request. Is there something similar in Rails?
On Sun, Apr 14, 2013 at 5:26 PM, Wins L. [email protected] wrote:
How to set some variables on bootstap? I need a few variables to be
initialized with default values every request. For example in ZF there
is a class Bootstrap whose methods are called automatically every
request. Is there something similar in Rails?
Do these need to be initialized before configuration? If not, you can
put them in config/initializers/
On Sun, Apr 14, 2013 at 6:31 PM, tamouse mailing lists
[email protected] wrote:
On Sun, Apr 14, 2013 at 5:26 PM, Wins L. [email protected] wrote:
How to set some variables on bootstap? I need a few variables to be
initialized with default values every request. For example in ZF there
is a class Bootstrap whose methods are called automatically every
request. Is there something similar in Rails?Do these need to be initialized before configuration? If not, you can
put them in config/initializers/
Never mind, I mis-read what you wrote.
ZF I’m assuming is Zend Framework, aka, PHP? Which works nothing like
Rails, btw, as you are essentially restarting the entire application
with every request in PHP.
The Rails application is not brought up and shut down for every
request. It lives in a long running process.
Maybe hardcoding them in a before_filter on ApplicationController…
Which kind of variables are you talking about? Where do you plan to use
them?
2013/4/14 tamouse mailing lists [email protected]
You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
–
Ricardo Franco Andrade
( Web | Desktop | Game ) Developer
email: [email protected]
phone: +55 (86) 9436 0830
linkedin: http://www.linkedin.com/pub/ricardo-franco/61/2b0/857
skype: ricardo.krieg
github: ricardokrieg (Ricardo Andrade) · GitHub
twitter: twitter.com/ricardokrieg
facebooK: Redirecting...
tamouse mailing lists wrote in post #1105626:
On Sun, Apr 14, 2013 at 6:31 PM, tamouse mailing lists
[email protected] wrote:Never mind, I mis-read what you wrote.
ZF I’m assuming is Zend Framework, aka, PHP? Which works nothing like
Rails, btw, as you are essentially restarting the entire application
with every request in PHP.
Yes, I meant Zend Framework.
The Rails application is not brought up and shut down for every
request. It lives in a long running process.
But how it can be? HTTP is a stateless protocol.
Ricardo Franco wrote in post #1105627:
Maybe hardcoding them in a before_filter on ApplicationController…
Which kind of variables are you talking about? Where do you plan to use
them?
Yes, “before_filter” works just fine. Yet do not understand the details
how it works but it works
I want to have a predefined variable in every method of my controllers.
It is @isAuth = false. I did like this in “application_controller.rb”:
before_filter :setAuth
def setAuth
@isAuth = false
end
Thanks.
On Mon, Apr 15, 2013 at 7:10 AM, Wins L. [email protected] wrote:
tamouse mailing lists wrote in post #1105626:
On Sun, Apr 14, 2013 at 6:31 PM, tamouse mailing lists
[email protected] wrote:
The Rails application is not brought up and shut down for every
request. It lives in a long running process.But how it can be? HTTP is a stateless protocol.
It is quite possible to build a statefull protocol on top of a stateless
one.
On Apr 15, 2013, at 8:10 AM, Wins L. wrote:
Yes, I meant Zend Framework.
The Rails application is not brought up and shut down for every
request. It lives in a long running process.But how it can be? HTTP is a stateless protocol.
Right, but Rails implements a full application server within its
long-running process, and maintains a session cookie to track individual
users across multiple request loops. PHP is just beginning to be able to
do this sort of thing, I think. Isn’t there a server in the latest beta
or alpha?
Walter