- provide(:title, "Plant Samples")
%h1 Plant Samples
= link_to "Generate Report", export_path(format: "csv"), class: 'btn btn-primary'
.table-responsive
  %table.table.table-striped
    %thead
      %tr
        %th Plot
        %th Species
        %th Date
        %th Time
        %th Temperature
        %th Species Richness
        %th Diversity Index
        %th Abundance
        %th Percent Cover
    %tbody
      - @plant_samples.each do |sample|
        %tr
          %td= sample.biodiversity_report.plot.name unless sample.biodiversity_report.nil?
          %td= sample.plant.common_name unless sample.plant.nil?
          %td= sample.biodiversity_report.measured_on.to_s(:long) unless sample.biodiversity_report.nil?
          %td= sample.biodiversity_report.measured_at.to_s(:ampm) unless sample.biodiversity_report.nil?
          %td= sample.biodiversity_report.temperature unless sample.biodiversity_report.nil?
          %td= sample.biodiversity_report.species_richness unless sample.biodiversity_report.nil?
          %td= sample.biodiversity_report.diversity_index unless sample.biodiversity_report.nil?
          %td= sample.abundance
          %td= sample.percent_cover
- provide(:title, "Plant Samples")
%h1 Plant Samples
= link_to "Generate Report", export_path(format: "csv"), class: 'btn btn-primary'
.table-responsive
  %table.table.table-striped
    %thead
      %tr
        %th Plot
        %th Species
        %th Date
        %th Time
        %th Temperature
        %th Species Richness
        %th Diversity Index
        %th Abundance
        %th Percent Cover
    %tbody
      - @plant_samples.each do |sample|
        %tr
          %td= sample.biodiversity_report.plot.name unless sample.biodiversity_report.nil?
          %td= sample&.plant.common_name
          %td= sample&.biodiversity_report.measured_on.to_s(:long)
          %td= sample&.biodiversity_report.measured_at.to_s(:ampm)
          %td= sample&.biodiversity_report.temperature
          %td= sample&.biodiversity_report.species_richness
          %td= sample&.biodiversity_report.diversity_index
          %td= sample.abundance
          %td= sample.percent_cover
Implement ruby's safe navigation operator
Implement ruby's safe navigation operator
