Hello Everyone, I am new to Ruby. My application revolves around the user having a "Customer" object and having that customer id in the session. Right now I have a customer service which creates the customer or finds one that has been created and adds the id to the session. However, I can''t guarantee that the customer service will be the first one hit when my application starts up. So my question is, what is the best way to ensure the creation or presence of a Customer object and customer id in the session regardless of which service is hit. Any help is greatly appreciated. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
can you give more details. what exactly do you mean by customer service? Is it an object a flow? sorry maybe someone else understands but I am trying to figure out what you mean by service. On Feb 8, 10:42 am, Jonah Jameson <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hello Everyone, > I am new to Ruby. My application revolves around the user having a > "Customer" object and having that customer id in the session. Right now > I have a customer service which creates the customer or finds one that > has been created and adds the id to the session. However, I can''t > guarantee that the customer service will be the first one hit when my > application starts up. > > So my question is, what is the best way to ensure the creation or > presence of a Customer object and customer id in the session regardless > of which service is hit. > > Any help is greatly appreciated. > > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
Thanks gerbdla, Bascially "CustomerService" is a controller (customer_controller.rb) that handles the operations concerning a Customer object in my application. This customer object is also represented by a table in the db. Now I have other controllers that handle other aspects of the application, however all of them are dependent on the existence of a Customer object/row reachable through the session. My application frontend is done in ExtJS, so it isn''t rendered by the usual RoR framework. I was thinking of adding a filter to my application controller which would verify and/or create the customer object should one not exists in the session, but I was unsure if this was best practice or not. If I''ve left more questions than answers please let me know. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.