Thanks Mark!

On Jan 28, 8:34 pm, Mark Reginald James <m...@bigpond.net.au> wrote:
> Nate Leavitt wrote:
> > Is the thread specific for the request in rails? Meaning.. the
> > before_filter will be run on each rails action/request therefore is a
> > new thread created in rails for that process?  Jeez.. I hope I'm
> > explaining it properly :)
>
> Yes, each thread only carries one request at time.
>
> > Also, since that before filter is creating a new AppConn obj do I have
> > to worry about performance?  It just seems that creating a new AppConn
> > for each rails request seems like overkill.  Am I wrong in thinking
> > that?
>
> Creating such a small AppConn object with each request shouldn't
> be a problem.
>
> If it is you can instead do
>
>     def self.set_account(url, key)
>       if ac = Thread.current[:api_conn]
>         ac.url, ac.key = url, key
>       else
>         Thread.current[:api_conn] = ApiConn.new(url, key)
>       end
>     end
>
> --
> Rails Wheels - Find Plugins, List & Sell Plugins -http://railswheels.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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to