<?xml version="1.0" encoding="UTF-8"?>
<wiki>
  <body>&lt;p&gt;This is more than likely a newbie question, but I don&#8217;t see it covered anywhere.&lt;/p&gt;
&lt;p&gt;The scenario is:&lt;/p&gt;
&lt;p&gt;I have two sites, one for back-end editing, one for front-end viewing. These are two separate Rails projects that share a single database. A team of reporters enters content into the back-end that shows up in the front-end.&lt;/p&gt;
&lt;p&gt;The back-end uses acts-as-authenticated. The front-end does not (because it&#8217;s public).&lt;/p&gt;
&lt;p&gt;The problem is, when the reporter (or anyone) logs into the back-end, and then goes to look at the front-end, the front-end clears the session, and now they have to log back into the back-end.&lt;/p&gt;
&lt;p&gt;Is there a way to avoid this?&lt;/p&gt;
&lt;p&gt;Thanks in advance!&lt;/p&gt;
&lt;p&gt;&#8212;&#8212;&#8212;&#8212;&#8212;&lt;/p&gt;
&lt;p&gt;Then make the front-end stop clearing the session. Simple really. Maybe you&#8217;re having issues with your session? Also, separate apps use separate session keys I believe. If not, they may be clobbering each other.&lt;/p&gt;
&lt;p&gt;The SessionManagement module shows how to modify the session. Use the session class method in your controllers to modify session properties for a group of actions, or config.session_options in environment.rb to change the default options.&lt;/p&gt;
&lt;p&gt;ActionController::Base.process_cgi lists the possible session options.&lt;/p&gt;
&lt;p&gt;This wiki probably isn&#8217;t the best place to ask questions. Try Rails Weenie.&lt;/p&gt;
&lt;p&gt;&#8212;&#8212;&#8212;&#8212;&#8212;&lt;/p&gt;
&lt;p&gt;The problem you are having is two cookies that creates two sessions. Let say you ahve two sites with these two URLs: admin.domain.com and www.domain.com. For such a situation what you need to do is setup your session to use the domain &#8221;.domain.com&#8221;. Then your browser will create only one cookie for both domains and you will end up with only one session.&lt;/p&gt;
&lt;p&gt;Hope it helps,&lt;/p&gt;
&lt;p&gt;Adrian Madrid&lt;br /&gt;
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&lt;/p&gt;
&lt;p&gt;Check out:&lt;/p&gt;
1. class ApplicationController &amp;lt; ActionController::Base
2. # &amp;#8230;
3.
4. &lt;span class=&quot;caps&quot;&gt;DOMAINS&lt;/span&gt; = [&amp;#8216;example.com&amp;#8217;, &amp;#8216;example.net&amp;#8217;].freeze
5.
6. &lt;span class=&quot;caps&quot;&gt;DOMAINS&lt;/span&gt;.each do |domain|
7. session :session_domain =&amp;gt; &amp;#8220;.#{domain}&amp;#8221;, :if =&amp;gt; lambda { |request| request.host.dup.chomp!(domain) }
8. end
9.
10. # &amp;#8230;
11. end
&lt;p&gt;http://www.railsweenie.com/forums/1/topics/597&lt;/p&gt;</body>
  <created-at type="datetime">2008-10-24T03:35:57-07:00</created-at>
  <id type="integer">71685</id>
  <permalink>using-with-multiple-sites</permalink>
  <repository-id type="integer">67186</repository-id>
  <title>Using with Multiple Sites</title>
  <updated-at type="datetime">2008-10-24T03:36:44-07:00</updated-at>
  <user-id type="integer">30799</user-id>
</wiki>
