Hi folks, I''m using ruby-GD and Rails to dynamically generate and serve images, as follows: require ''GD'' ... def image g = GD::Image.new(100,100) g.colorAllocate(255,255,255) red = g.colorAllocate(255,0,0) g.line(10,10,90,90,red) @headers["Content-Type"] = "image/png" render_text g.pngStr end This works just beautifully under ordinary CGI. However, FCGI complains about having two "Content-Type" headers. There is only one in the output if run under CGI, so Apache must strip out the duplicate, but under FCGI it crashes and returns 500 Infernal Server Error instead. Why is the (presumably) text/html header not getting replaced? Tim. -- Tim Bates tim-kZbwfhiKUx26c6uEtOJ/EA@public.gmane.org
>>>>> "Tim" == Tim Bates <tim-kZbwfhiKUx26c6uEtOJ/EA@public.gmane.org> writes:Tim> @headers["Content-Type"] = "image/png" Tim> This works just beautifully under ordinary CGI. However, FCGI Tim> complains about having two "Content-Type" headers. There is Tim> only one in the output if run under CGI, so Apache must strip Tim> out the duplicate, but under FCGI it crashes and returns 500 Tim> Infernal Server Error instead. Why is the (presumably) Tim> text/html header not getting replaced? Wild guess -- does using "Content-type" (note capitalization) make any difference? Gleb
>>>>> "Tim" == Tim Bates <tim-kZbwfhiKUx26c6uEtOJ/EA@public.gmane.org> writes:Tim> @headers["Content-Type"] = "image/png" Also, in similar code I do: @response.headers["Content-Type"] = "text/plain" Gleb
Gleb Arshinov wrote:> Tim> @headers["Content-Type"] = "image/png" > > Also, in similar code I do: > > @response.headers["Content-Type"] = "text/plain"Thanks for the suggestion. When I tried to recreate the original problem today, I couldn''t repeat it. The above worked, as did my original code. I don''t know what changed in the meantime, so I''m a little perplexed. Tim. -- Tim Bates tim-kZbwfhiKUx26c6uEtOJ/EA@public.gmane.org
> I don''t know what changed in the meantime, so I''m a little perplexed.You probably upgraded Rails. This used to be a problem, but was fixed. -- David Heinemeier Hansson, http://www.basecamphq.com/ -- Web-based Project Management http://www.rubyonrails.org/ -- Web-application framework for Ruby http://macromates.com/ -- TextMate: Code and markup editor (OS X) http://www.loudthinking.com/ -- Broadcasting Brain
Hello, I''ve got some troubles, when I''m reimplementing my first rails application with tests. I got view, which normaly render on production system. Code is clear I think: code: <%= form_tag({ :action => @target }) %> <%= hidden_field "question", "id" %> <h3>Text:</h3> <%= text_area "question", "text", "cols" => 60 %> <h3>Okruh:</h3> <select name="question[area_id]"> <% options_for_select(get_areas, @question.area.id) %> </select> <input type="submit" value="Ulozit" /> </form> It''s in the partial, so I can use this form for more views. But the problem arise, when I''m trying to do functional tests. It yields to: stact_trace: ActionView::TemplateError: wrong number of arguments (0 for 1) /opt/...gems/actionpack-0.9.0.20041105/lib/action_view/base.rb:172:in `render_file'' /opt/...gems/actionpack-0.9.0.20041105/lib/action_view/base.rb:180:in `render'' /opt/...gems/actionpack-0.9.0.20041105/lib/action_view/partials.rb:37: in `render_partial'' (erb)... /opt/...gems/actionpack-0.9.0.20041105/lib/action_view/base.rb:191:in `render_template'' /opt/...gems/actionpack-0.9.0.20041105/lib/action_view/base.rb:166:in `render_file'' /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/layout.rb: 136:in `render_without_benchmark'' /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ benchmarking.rb:22:in `render'' /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ benchmarking.rb:22:in `measure'' /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ benchmarking.rb:22:in `render'' /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/base.rb: 564:in `perform_action_without_filters'' /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ filters.rb:236:in `perform_action_without_benchmark'' /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ benchmarking.rb:30:in `perform_action_without_rescue'' /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ benchmarking.rb:30:in `measure'' /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ benchmarking.rb:30:in `perform_action_without_rescue'' /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/rescue.rb: 68:in `perform_action'' /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/base.rb: 254:in `process'' /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ test_process.rb:192:in `process'' ./test/functional/qadmin_controller_test.rb:50:in `test_new'' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = process "new" Maybe I''m doing something wrong, but I can''t see any way how to work around. The worst thing is that it''s *only* in tests :-(. Thanks for any help or suggestion. Pepe
I just found out, that if I comment out text_area method call everything works fine. Hope it helps, cause I can''t see any way how to solve it. Maybe it''s common punishment for doing something good (test driven development in this case:) Pepe On 14.11.2004, at 12:50, Josef Pospisil wrote:> Hello, > > I''ve got some troubles, when I''m reimplementing my first rails > application with tests. I got view, which normaly render on production > system. Code is clear I think: > > code: > <%= form_tag({ :action => @target }) %> > <%= hidden_field "question", "id" %> > <h3>Text:</h3> > <%= text_area "question", "text", "cols" => 60 %> > <h3>Okruh:</h3> > <select name="question[area_id]"> > <%> options_for_select(get_areas, @question.area.id) %> > </select> > <input type="submit" value="Ulozit" /> > </form> > > It''s in the partial, so I can use this form for more views. > > But the problem arise, when I''m trying to do functional tests. It > yields to: > > stact_trace: > ActionView::TemplateError: wrong number of arguments (0 for 1) > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_view/base.rb:172:in > `render_file'' > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_view/base.rb:180:in > `render'' > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_view/partials.rb:37: > in `render_partial'' > (erb)... > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_view/base.rb:191:in > `render_template'' > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_view/base.rb:166:in > `render_file'' > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ > layout.rb:136:in `render_without_benchmark'' > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ > benchmarking.rb:22:in `render'' > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ > benchmarking.rb:22:in `measure'' > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ > benchmarking.rb:22:in `render'' > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/base.rb: > 564:in `perform_action_without_filters'' > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ > filters.rb:236:in `perform_action_without_benchmark'' > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ > benchmarking.rb:30:in `perform_action_without_rescue'' > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ > benchmarking.rb:30:in `measure'' > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ > benchmarking.rb:30:in `perform_action_without_rescue'' > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ > rescue.rb:68:in `perform_action'' > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/base.rb: > 254:in `process'' > > /opt/...gems/actionpack-0.9.0.20041105/lib/action_controller/ > test_process.rb:192:in `process'' > ./test/functional/qadmin_controller_test.rb:50:in `test_new'' > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = process "new" > > Maybe I''m doing something wrong, but I can''t see any way how to work > around. The worst thing is that it''s *only* in tests :-(. > > Thanks for any help or suggestion. > > Pepe > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >