fix_NoMethodError_in_SearchController.diff

Angel Sciortino, 2008-03-10 00:20

Download (1.85 KB)

View differences:

test/functional/search_controller_test.rb (working copy)
78 78
    assert_equal 2, results.size
79 79
  end
80 80
  
81
  def test_search_with_invalid_project_id
82
    get :index, :id => 195, :q => 'recipe'
83
    assert_response 404
84
    assert_nil assigns(:results)    
85
  end
81 86
  def test_quick_jump_to_issue
82 87
    # issue of a public project
83 88
    get :index, :q => "3"
app/controllers/application.rb (working copy)
102 102
  # make sure that the user is a member of the project (or admin) if project is private
103 103
  # used as a before_filter for actions that do not require any particular permission on the project
104 104
  def check_project_privacy
105
    unless @project.active?
105
    if @project && @project.active?
106
      return true if @project.is_public? || User.current.member_of?(@project) || User.current.admin?
107
      User.current.logged? ? render_403 : require_login
108
    else
106 109
      @project = nil
107 110
      render_404
108 111
      return false
109 112
    end
110
    return true if @project.is_public? || User.current.member_of?(@project) || User.current.admin?
111
    User.current.logged? ? render_403 : require_login
112 113
  end
113 114

  
114 115
  # store current uri in session.
app/controllers/search_controller.rb (working copy)
107 107
  def find_project
108 108
    @project = Project.find(params[:id])
109 109
  rescue ActiveRecord::RecordNotFound
110
    render_404
111 110
  end
112 111
end