All, I see this item on the merb-0.0.8 release notes Added rails session parasite mode. I am assuming merbs can piggy back off the rails current session. How does one achieve that ? Thanks Fernand -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/merb-devel/attachments/20070112/0803f46e/attachment.html
On Jan 12, 2007, at 8:30 AM, Fernand Galiana wrote:> All, > > I see this item on the merb-0.0.8 release notes > Added rails session parasite mode. > > I am assuming merbs can piggy back off the rails current session. > How does one achieve that ? > > Thanks > Fernand >Hey Fernand- Yes to piggyback on rails sessions, you need to point merb''s db connection at your rails database session table. Then in merb.yml you need to set :sql_session: true Then when you redirect to merb from rails you append the session id to the query string like : /merb/action?_session_id=asdkljfhaklsdfnaddanlafldlkdf Then you will be able to use the session has on merb and it will have the contents from rails. -- Ezra Zygmuntowicz -- Lead Rails Evangelist -- ez at engineyard.com -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273)
Thank you all for replying... Now the key question here is how do I tell the session to persist before delegating to merb. It seems that the session gets persisted underneath the scene by rails and my session state gets out of wack between rails and merb. Thus if in my rails controller I have: def my_action session[:fred] = "blee" # call merb .... end The first time I hit my_action. Merb does not see fred.... Any ideas ?? On 1/14/07, Ezra Zygmuntowicz <ez at engineyard.com> wrote:> > > On Jan 12, 2007, at 8:30 AM, Fernand Galiana wrote: > > > All, > > > > I see this item on the merb-0.0.8 release notes > > Added rails session parasite mode. > > > > I am assuming merbs can piggy back off the rails current session. > > How does one achieve that ? > > > > Thanks > > Fernand > > > > Hey Fernand- > > > Yes to piggyback on rails sessions, you need to point merb''s db > connection at your rails database session table. Then in merb.yml you > need to set > :sql_session: true > > Then when you redirect to merb from rails you append the session > id > to the query string like : > > /merb/action?_session_id=asdkljfhaklsdfnaddanlafldlkdf > > Then you will be able to use the session has on merb and it will > have the contents from rails. > > > -- Ezra Zygmuntowicz > -- Lead Rails Evangelist > -- ez at engineyard.com > -- Engine Yard, Serious Rails Hosting > -- (866) 518-YARD (9273) > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/merb-devel/attachments/20070115/bc5ce250/attachment.html
On Jan 15, 2007, at 6:40 PM, Fernand Galiana wrote:> Thank you all for replying... > > Now the key question here is how do I tell the session to persist > before delegating > to merb. It seems that the session gets persisted underneath the > scene by rails and > my session state gets out of wack between rails and merb. > > Thus if in my rails controller I have: > > def my_action > session[:fred] = "blee" > > # call merbwhat does call merb do? You should do a redirect to merb. That way rails will finalize the sessions before merb gets the result. If that doesn''t work then thereis a way to make the rails sessions flush but i can''t recall what the method is right now. Cheers- -- Ezra Zygmuntowicz -- Lead Rails Evangelist -- ez at engineyard.com -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273)
Hey Ezra, A redirect won''t work as I need to return results from the merb call. Basically I am retrieving some xml from the rails action by calling merb. If you stumble upon the session flush/store call, please ping me back... Thanks, Fernand On 1/15/07, Ezra Zygmuntowicz <ez at engineyard.com> wrote:> > > On Jan 15, 2007, at 6:40 PM, Fernand Galiana wrote: > > > Thank you all for replying... > > > > Now the key question here is how do I tell the session to persist > > before delegating > > to merb. It seems that the session gets persisted underneath the > > scene by rails and > > my session state gets out of wack between rails and merb. > > > > Thus if in my rails controller I have: > > > > def my_action > > session[:fred] = "blee" > > > > # call merb > > what does call merb do? You should do a redirect to merb. That way > rails will finalize the sessions before merb gets the result. If that > doesn''t work then thereis a way to make the rails sessions flush but > i can''t recall what the method is right now. > > Cheers- > > -- Ezra Zygmuntowicz > -- Lead Rails Evangelist > -- ez at engineyard.com > -- Engine Yard, Serious Rails Hosting > -- (866) 518-YARD (9273) > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/merb-devel/attachments/20070115/4633bd20/attachment.html
Fernand, If you''re on the same domain, using rewrites at the frontend server level... then making calls to merb is no different than making calls to the rails app. For instance, http://myapp/files <-- there''s a rewrite rule I have to proxy all requests to /files to my merb app... but from merb I can call methods from controllers in my rails app... since they both share the same domain. I hope I''m making sense. -Rogelio On 1/15/07, Fernand Galiana <fernand.galiana at gmail.com> wrote:> Hey Ezra, > > A redirect won''t work as I need to return results from the merb call. > Basically I am retrieving some xml from the rails action by calling merb. > If you stumble upon the session flush/store call, please ping me > back... > > Thanks, > Fernand > > On 1/15/07, Ezra Zygmuntowicz < ez at engineyard.com> wrote: > > > > > > On Jan 15, 2007, at 6:40 PM, Fernand Galiana wrote: > > > > > Thank you all for replying... > > > > > > Now the key question here is how do I tell the session to persist > > > before delegating > > > to merb. It seems that the session gets persisted underneath the > > > scene by rails and > > > my session state gets out of wack between rails and merb. > > > > > > Thus if in my rails controller I have: > > > > > > def my_action > > > session[:fred] = "blee" > > > > > > # call merb > > > > what does call merb do? You should do a redirect to merb. That way > > rails will finalize the sessions before merb gets the result. If that > > doesn''t work then thereis a way to make the rails sessions flush but > > i can''t recall what the method is right now. > > > > Cheers- > > > > -- Ezra Zygmuntowicz > > -- Lead Rails Evangelist > > -- ez at engineyard.com > > -- Engine Yard, Serious Rails Hosting > > -- (866) 518-YARD (9273) > > > > > > > > _______________________________________________ > Merb-devel mailing list > Merb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/merb-devel > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/merb-devel/attachments/20070116/7c19d9b7/attachment-0001.html