On Thu, Feb 24, 2011 at 4:29 PM, Mauro <[email protected]> wrote:
> On 24 February 2011 17:48, exequiel <[email protected]> wrote:
> >> But if I want fetch the operator only once at application startup?
> >
> > I guess you can set up a session variable to make sure to call only
> > once.
> >
> > if !session[:operator_called]
> > ...
> > session[:operator_called] = true
> > end
> >
> In a method of application controller?
It's just an example, you can add that piece of code in any method, for
example:
class ApplicationController < ActionController::Base
...
before_filter :call_operator_once
...
def call_operator_once
if !session[:operator_called]
fetch_operator()
!session[:operator_called] = true
end
end
end
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.