class PlanningApplication::IssuesController < IssuesController
  before_filter :load_planning_application
  before_filter :check_for_issue

  def new
    @issue = @planning_application.populate_issue
    @start_location = @planning_application.location
    render 'issues/new'
  end

  protected

  def load_planning_application
    @planning_application = PlanningApplication.find params[:planning_application_id]
  end

  def check_for_issue
    if @planning_application.issue
      set_flash_message :already
      redirect_to planning_application_path @planning_application
    end
  end
end

class PlanningApplication::IssuesController < IssuesController
  before_filter :load_planning_application
  before_filter :check_for_issue

  def new
    @issue = @planning_application.populate_issue
    @start_location = @planning_application.location || index_start_location
    render 'issues/new'
  end

  protected

  def load_planning_application
    @planning_application = PlanningApplication.find params[:planning_application_id]
  end

  def check_for_issue
    if @planning_application.issue
      set_flash_message :already
      redirect_to planning_application_path @planning_application
    end
  end
end

Add a default if a planning app has no location
Add a default if a planning app has no location

Fixes #508
