spec/dummy/app/controllers/reports_controller.rb
def form
    if params[:id].to_s =~ /^\d+$/
      @report = Report.find(params[:id])
    elsif Report.respond_to?(params[:id])
      @report = Report.find_by_name(params[:id])
    else
      redirect_to reports_url, notice: 'That report does not exist'
      return
    end
    render "reports/forms/form"
  end
# remember to add authentication/authorization. E.g:
# before_filter :require_user
# load_and_authorize_resource
remember to add authentication/authorization.
remember to add authentication / authorization .
def form
    if params[:id].to_s =~ /^\d+$/
      @report = Report.find(params[:id])
    elsif Report.respond_to?(params[:id])
      @report = Report.find_by_name(params[:id])
    else
      redirect_to reports_url, notice: 'That report does not exist'
      return
    end
    render "reports/forms/form"
  end
def form if params [ :id ] . to_s =~ / ^ \d +$ / @report = Report . find ( params [ :id ] ) elsif Report . respond_to? ( params [ :id ] ) @report = Report . find_by_name ( params [ :id ] ) else redirect_to reports_url , notice : 'That report does not exist' return end render "reports/forms/form" end
remember to add authentication/authorization.
remember to add authentication / authorization .