Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom rails route problem with 2.3.8 and Mongrel
    primarykey
    data
    text
    <p>I have a controller called 'exposures' which I created automatically with the script/generate scaffold call. The scaffold pages work fine. I created a custom action called 'test' in the exposures controller. When I try to call the page (<a href="http://127.0.0.1:3000/exposures/test/1" rel="nofollow noreferrer">http://127.0.0.1:3000/exposures/test/1</a>) I get a blank, white screen with no text at all in the source. </p> <p>I am using Rails 2.3.8 and mongrel in the development environment. There are no entries in development.log and the console that was used to open mongrel has the following error:</p> <blockquote> <p>You might have expected an instance of Array. The error occurred while evaluating nil.split> D:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/cgi_process.rb:52:in <code>dispatch_cgi' D:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:101:in</code>dispatch_cgi' D:/Rails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:27:in <code>dispatch' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel/rails.rb:76:in</code>process' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel/rails.rb:74:in <code>synchronize' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel/rails.rb:74:in</code>process' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:159:in <code>process_client' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:158:in</code>each' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:158:in <code>process_client' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:285:in</code>run' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:285:in <code>initialize' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:285:in</code>new' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:285:in <code>run' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:268:in</code>initialize' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:268:in <code>new' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel.rb:268:in</code>run' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel/configurator.rb:282:in <code>run' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel/configurator.rb:281:in</code>each' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel/configurator.rb:281:in <code>run' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/mongrel_rails:128:in </code>run' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/../lib/mongrel/command.rb:212:in <code>run' D:/Rails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/mongrel_rails:281 D:/Rails/ruby/bin/mongrel_rails:19:in</code>load' D:/Rails/ruby/bin/mongrel_rails:19</p> </blockquote> <p>Here is the exposures_controller code:</p> <pre><code>class ExposuresController &lt; ApplicationController # GET /exposures # GET /exposures.xml def index @exposures = Exposure.all respond_to do |format| format.html # index.html.erb format.xml { render :xml =&gt; @exposures } end end #/exposure/graph/1 def graph @exposure = Exposure.find(params[:id]) project_name = @exposure.tender.project.name group_name = @exposure.tender.user.group.name tender_desc = @exposure.tender.description direction = "Cash Out" direction = "Cash In" if @exposure.supply currency_1_and_2 = "#{@exposure.currency_in} =&gt; #{@exposure.currency_out}" title = "#{project_name}:#{group_name}:#{tender_desc}/n" title += "#{direction}:#{currency_1_and_2}" factors = Array.new carrieds = Array.new days = Array.new @exposure.rates.each do |r| factors &lt;&lt; r.factor carrieds &lt;&lt; r.carried days &lt;&lt; r.day.to_s end max = (factors+carrieds).max min = (factors+carrieds).min g = Graph.new g.title(title, '{font-size: 12px;}') g.set_data(factors) g.line_hollow(2, 4, '0x80a033', 'Bounces', 10) g.set_x_labels(days) g.set_x_label_style( 10, '#CC3399', 2 ); g.set_y_min(min*0.9) g.set_y_max(max*1.1) g.set_y_label_steps(5) render :text =&gt; g.render end def test render :text =&gt; "this works" end # GET /exposures/1 # GET /exposures/1.xml def show @exposure = Exposure.find(params[:id]) @graph = open_flash_chart_object(700,250, "/exposures/graph/#{@exposure.id}") #@graph = "/exposures/graph/#{@exposure.id}" respond_to do |format| format.html # show.html.erb format.xml { render :xml =&gt; @exposure } end end # GET /exposures/new # GET /exposures/new.xml def new @exposure = Exposure.new respond_to do |format| format.html # new.html.erb format.xml { render :xml =&gt; @exposure } end end # GET /exposures/1/edit def edit @exposure = Exposure.find(params[:id]) end # POST /exposures # POST /exposures.xml def create @exposure = Exposure.new(params[:exposure]) respond_to do |format| if @exposure.save flash[:notice] = 'Exposure was successfully created.' format.html { redirect_to(@exposure) } format.xml { render :xml =&gt; @exposure, :status =&gt; :created, :location =&gt; exposure } else format.html { render :action =&gt; "new" } format.xml { render :xml =&gt; @exposure.errors, :status =&gt; unprocessable_entity} end end end # PUT /exposures/1 # PUT /exposures/1.xml def update @exposure = Exposure.find(params[:id]) respond_to do |format| if @exposure.update_attributes(params[:exposure]) flash[:notice] = 'Exposure was successfully updated.' format.html { redirect_to(@exposure) } format.xml { head :ok } else format.html { render :action =&gt; "edit" } format.xml { render :xml =&gt; @exposure.errors, :status =&gt; unprocessable_entity} end end end # DELETE /exposures/1 # DELETE /exposures/1.xml def destroy @exposure = Exposure.find(params[:id]) @exposure.destroy respond_to do |format| format.html { redirect_to(exposures_url) } format.xml { head :ok } end end end </code></pre> <p>Clever readers will notice the 'graph' action. This is what I really want to work, but if I can't even get the test action working, then I'm sure I have no chance. </p> <p>Any ideas? I have restarted mongrel a few times with no change.</p> <p>Here is the output of Rake routes (but I don't believe this is the problem. The error would be in the form of and HTML error response).</p> <pre><code>D:\Rails\rails_apps\fx&gt;rake routes (in D:/Rails/rails_apps/fx) DEPRECATION WARNING: Rake tasks in vendor/plugins/open_flash_chart/tasks are deprecated. Use lib/tasks instead. (called from D:/ by/gems/1.8/gems/rails-2.3.8/lib/tasks/rails.rb:10) rates GET /rates(.:format) {:controller=&gt;"rates", :action=&gt;"index"} POST /rates(.:format) {:controller=&gt;"rates", :action=&gt;"create"} new_rate GET /rates/new(.:format) {:controller=&gt;"rates", :action=&gt;"new"} edit_rate GET /rates/:id/edit(.:format) {:controller=&gt;"rates", :action=&gt;"edit"} rate GET /rates/:id(.:format) {:controller=&gt;"rates", :action=&gt;"show"} PUT /rates/:id(.:format) {:controller=&gt;"rates", :action=&gt;"update"} DELETE /rates/:id(.:format) {:controller=&gt;"rates", :action=&gt;"destroy"} tenders GET /tenders(.:format) {:controller=&gt;"tenders", :action=&gt;"index"} POST /tenders(.:format) {:controller=&gt;"tenders", :action=&gt;"create"} new_tender GET /tenders/new(.:format) {:controller=&gt;"tenders", :action=&gt;"new"} edit_tender GET /tenders/:id/edit(.:format) {:controller=&gt;"tenders", :action=&gt;"edit"} tender GET /tenders/:id(.:format) {:controller=&gt;"tenders", :action=&gt;"show"} PUT /tenders/:id(.:format) {:controller=&gt;"tenders", :action=&gt;"update"} DELETE /tenders/:id(.:format) {:controller=&gt;"tenders", :action=&gt;"destroy"} exposures GET /exposures(.:format) {:controller=&gt;"exposures", :action=&gt;"index"} POST /exposures(.:format) {:controller=&gt;"exposures", :action=&gt;"create"} new_exposure GET /exposures/new(.:format) {:controller=&gt;"exposures", :action=&gt;"new"} edit_exposure GET /exposures/:id/edit(.:format) {:controller=&gt;"exposures", :action=&gt;"edit"} exposure GET /exposures/:id(.:format) {:controller=&gt;"exposures", :action=&gt;"show"} PUT /exposures/:id(.:format) {:controller=&gt;"exposures", :action=&gt;"update"} DELETE /exposures/:id(.:format) {:controller=&gt;"exposures", :action=&gt;"destroy"} currencies GET /currencies(.:format) {:controller=&gt;"currencies", :action=&gt;"index"} POST /currencies(.:format) {:controller=&gt;"currencies", :action=&gt;"create"} new_currency GET /currencies/new(.:format) {:controller=&gt;"currencies", :action=&gt;"new"} edit_currency GET /currencies/:id/edit(.:format) {:controller=&gt;"currencies", :action=&gt;"edit"} currency GET /currencies/:id(.:format) {:controller=&gt;"currencies", :action=&gt;"show"} PUT /currencies/:id(.:format) {:controller=&gt;"currencies", :action=&gt;"update"} DELETE /currencies/:id(.:format) {:controller=&gt;"currencies", :action=&gt;"destroy"} projects GET /projects(.:format) {:controller=&gt;"projects", :action=&gt;"index"} POST /projects(.:format) {:controller=&gt;"projects", :action=&gt;"create"} new_project GET /projects/new(.:format) {:controller=&gt;"projects", :action=&gt;"new"} edit_project GET /projects/:id/edit(.:format) {:controller=&gt;"projects", :action=&gt;"edit"} project GET /projects/:id(.:format) {:controller=&gt;"projects", :action=&gt;"show"} PUT /projects/:id(.:format) {:controller=&gt;"projects", :action=&gt;"update"} DELETE /projects/:id(.:format) {:controller=&gt;"projects", :action=&gt;"destroy"} groups GET /groups(.:format) {:controller=&gt;"groups", :action=&gt;"index"} POST /groups(.:format) {:controller=&gt;"groups", :action=&gt;"create"} new_group GET /groups/new(.:format) {:controller=&gt;"groups", :action=&gt;"new"} edit_group GET /groups/:id/edit(.:format) {:controller=&gt;"groups", :action=&gt;"edit"} group GET /groups/:id(.:format) {:controller=&gt;"groups", :action=&gt;"show"} PUT /groups/:id(.:format) {:controller=&gt;"groups", :action=&gt;"update"} DELETE /groups/:id(.:format) {:controller=&gt;"groups", :action=&gt;"destroy"} users GET /users(.:format) {:controller=&gt;"users", :action=&gt;"index"} POST /users(.:format) {:controller=&gt;"users", :action=&gt;"create"} new_user GET /users/new(.:format) {:controller=&gt;"users", :action=&gt;"new"} edit_user GET /users/:id/edit(.:format) {:controller=&gt;"users", :action=&gt;"edit"} user GET /users/:id(.:format) {:controller=&gt;"users", :action=&gt;"show"} PUT /users/:id(.:format) {:controller=&gt;"users", :action=&gt;"update"} DELETE /users/:id(.:format) {:controller=&gt;"users", :action=&gt;"destroy"} /:controller/:action/:id /:controller/:action/:id(.:format) </code></pre> <p>Thanks in advance for the help</p> <p>-Jon</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload