Guest User

Untitled

a guest
Apr 15th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. Index: app/controllers/browser_controller.rb
  2. ===================================================================
  3. --- app/controllers/browser_controller.rb (revision 2335)
  4. +++ app/controllers/browser_controller.rb (working copy)
  5. @@ -6,6 +6,10 @@
  6.  
  7. helper_method :current_revision, :current_changeset, :previous_changeset, :next_changeset
  8.  
  9. + expiring_attr_reader :current_changeset, :retrieve_current_changeset
  10. + expiring_attr_reader :previous_changeset, :retrieve_previous_changeset
  11. + expiring_attr_reader :next_changeset, :retrieve_next_changeset
  12. +
  13. def index
  14. @bookmark = Bookmark.new(:path => @node.path)
  15. @changesets = current_repository.changesets.find_all_by_path(@node.path, :limit => 5, :order => 'changesets.changed_at desc')
  16. @@ -45,15 +49,17 @@
  17. @node = current_repository.node(params[:paths] * '/', @revision)
  18. end
  19.  
  20. - def current_changeset
  21. - @current_changeset ||= current_repository.changesets.find_latest_changeset(@node.path, @revision)
  22. + def retrieve_current_changeset
  23. + current_repository.changesets.find_latest_changeset(@node.path, @revision)
  24. end
  25.  
  26. - def previous_changeset
  27. - @previous_changeset ||= current_repository.changesets.find_by_path(@node.path, :conditions => ['changed_at < ?', current_changeset.changed_at], :order => 'changesets.changed_at desc')
  28. + def retrieve_previous_changeset
  29. + return nil if current_changeset.nil?
  30. + current_repository.changesets.find_by_path(@node.path, :conditions => ['changed_at < ?', current_changeset.changed_at], :order => 'changesets.changed_at desc')
  31. end
  32.  
  33. - def next_changeset
  34. - @next_changeset ||= current_repository.changesets.find_by_path(@node.path, :conditions => ['changed_at > ?', current_changeset.changed_at], :order => 'changesets.changed_at')
  35. + def retrieve_next_changeset
  36. + return nil if current_changeset.nil?
  37. + current_repository.changesets.find_by_path(@node.path, :conditions => ['changed_at > ?', current_changeset.changed_at], :order => 'changesets.changed_at')
  38. end
  39. end
Add Comment
Please, Sign In to add comment