mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-02-04 22:51:04 -05:00
Merge pull request #682 from maco/dev
fixing harvest csv so it doesn't error
This commit is contained in:
@@ -20,7 +20,7 @@ class HarvestsController < ApplicationController
|
||||
format.html { @harvests = @harvests.paginate(:page => params[:page]) }
|
||||
format.json { render json: @harvests }
|
||||
format.csv do
|
||||
specifics = (@owner ? "#{@owner.name}-" : @crop ? "#{@crop.name}-" : nil)
|
||||
specifics = (@owner ? "#{@owner.login_name}-" : @crop ? "#{@crop.name}-" : nil)
|
||||
@filename = "Growstuff-#{specifics}Harvests-#{Time.zone.now.to_s(:number)}.csv"
|
||||
render :csv => @harvests
|
||||
end
|
||||
|
||||
@@ -37,6 +37,11 @@ describe HarvestsController do
|
||||
assigns(:crop).should eq @maize
|
||||
assigns(:harvests).should eq [@harvest2]
|
||||
end
|
||||
|
||||
it "generates a csv" do
|
||||
get :index, {:format => "csv"}
|
||||
response.status.should eq 200
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET show" do
|
||||
|
||||
Reference in New Issue
Block a user