NoMethodError (undefined method `status=' for #<xxxController:0x10b689a50>):
anlek opened this issue · 8 comments
Not sure what happened, but my render :csv doesnt' seem to work
def index
@search = UserSearch.new(params[:user_search])
respond_to do |format|
format.html do
@users = @search.users.paginate(:page => params[:page])
render :action => "index"
end
format.csv { render :csv => @search.users }
end
end
Here is the full output:
https://gist.github.com/2291255
I tried from version 0.4.3 till 2.0 (since I'm running rails 2.3)
Also tried rails 2.3.12 - 2.3.14.
Not sure where to go from here.
Hi Kalek, will try and get a chance to look at this on the weekend, unfortunately I haven't locked down the rails controller specs in the 2.0 branch (like i have in the 3.x branch).
From a quick look, it looks like it is firing the wrong streaming method in RenderAsCsv for your Rails version. Which is a bit weird. Really, 2.3.14 should be firing the self.response_body method not the first :status => x
way in that class.
Could you please try commenting out that conditional, leaving only the self.response_body option, not the one that is firing. Just bundle open comma
and restart your dev server, then see if it still explodes.
I'll try looking at this soon. Cheers.
I also have this same issue on the rails2 branch.
I did what @tommeier suggested, it returns a "ActionView::MissingTemplate error" now. (rails2 branch)
Also saw that others were getting the same error here (in the comments):
http://rubyrailsandwindows.blogspot.com/2009/06/rails-view-export-to-csv.html
I submitted 2 patches for the rails 2 branch. In case the author isn't active on this gem - also forked and fixed here: https://github.com/jrissler/comma/tree/rails2
Apologies, haven't had a chance to sort this out.
In desperate need of full rails based specs as implemented in the master branch but for the Rails 2 branch (little trickier with rspec-rails in Rails 2.x land).
@jrissler - please resubmit your patch to the Rails 2.x branch and I'll merge in the fix if this issue is resolved for you.
@jrissler I've tried your fork and it works great! Thanks and I can't wait till it's pulled into the main repo!