On 5/29/06, Berlin Brown <bigbinc097@comcast.net>
wrote:> In a servlet J2EE application, there is an init style method that gets
> called after that servlet is loaded. Is there something similar within
> a rails controller context. I am looking for something where I can load
> and setup a particular object.
Perhaps you want a before_filter?
http://api.rubyonrails.com/classes/ActionController/Filters/ClassMethods.html#M000150
> Also, what about with sessions as well. I would like to call some
> library when a user session begins and possibly kill that object when
> the session ends.
Sessions are usually automatically created on Rails, by default, upon
first access. So it seems doubtful that there is a special callback,
since they are "nothing special". However, you can easily setup a
global method (through ApplicationController) that would
setup/teardown session, something like start_session/end_session.
> --
> Berlin Brown
> (ramaza3 on freenode)
> http://www.newspiritcompany.com
> http://www.newspiritcompany.com/newforums
> also checkout alpha version of botverse:
> http://www.newspiritcompany.com:8086/universe_home
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
--
-Alder