More RoR refresh/caching strangeness  happening in RC3
------------------------------------------------------

                 Key: JRUBY-1092
                 URL: http://jira.codehaus.org/browse/JRUBY-1092
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.0.0RC3
         Environment: JRuby 1.0RC3+Windows XP+Java 1.6_01
            Reporter: Morten Christensen
            Assignee: Thomas E Enebo
            Priority: Critical


As originally reported in "http://jira.codehaus.org/browse/JRUBY-968"; I have 
encountered some weird behavior since RC2.... Fortunately, it is less weird in 
RC3 as the strange content type text at the top no longer has a mysterious 
appearance on the site. The remaining problem is that the pages in my app still 
does not appear the first time I access the page. Page content only appears 
when I reload the page. Again, this behavior is for JRuby only! It works 
perfectly on standard C Ruby 1.8.6.

Luckily, I think I have been able to reproduce the problem consistently this 
time as RC3 has more predictable behavior. The problem seems to be connected to 
session handling in my Application Controller which looks like the code 
below... To recreate the problem add the following to an existing rails project.

class ApplicationController < ActionController::Base
  session :session_key => 'XSiteSid'
  
  before_filter :add_to_history
  helper_method :page_title, :genre_clazz, :person_type, :author_role_type
  
  protected
  def page_title
    "Title unknown for '" + request.path + "'"
  end
  
  private
  def add_to_history # Snippit from "http://snippets.dzone.com/posts/show/537";
    session[:history] ||= []
    if 
File.exists?("#{RAILS_ROOT}/app/views/#{self.controller_name}/#{self.action_name}.rhtml")
 && session[:history].empty? || session[:history].first['uri'] != 
@request.request_uri
        session[:history].unshift({ 'uri' => @request.request_uri, 'name' => 
page_title() })
        session[:history].pop while session[:history].length > 5
    end
  end
end

P.S. Don't think it is necessary to reproduce the bug but if you want you can 
do something like the code below in a view to show the history:
<% for cur in session[:history][0..9] -%><p><a href="<%= cur["uri"] %>"><%= 
cur["name"] %>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to