Wrong Number of Arguments 0 for 3 when calling partial

I'm hoping someone can help me solve this problem which I believe has to do with my initial configuration of Rails on my server since the simplest of code which calls a partial works on one server but not another.

in ROOT_RAILS/view/test/_trap.rhtml:

   Hello World

in ROOT_RAILS/view/index.rhtml

   <%= render :partial => 'trap' %>

Does anyone have any ideas what Rails is looking for here or why I continue to get this error?

thanks

jackster.mobi

Can you give us the backtrace to this error please?

Sure thing Ryan...thanks for kicking this around with me. I'm at the point where I'm thinking I need to blow away my Rails install and start from scratch. Here is the error from the log:

ActionView::TemplateError (wrong number of arguments (0 for 3)) on line #3 of trap/js.rhtml: 1: <%= periodically_call_remote( :update => "status",:frequency => 2, :url => { :action => :update_data }) %> 2: <div id="status"> 3: <%= render :partial => 'trap', :collection => @trap %> 4: </div> 5: <% for trap in @trap %> 6: <%= trap.ipadd %>

    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ partials.rb:115:in `logger'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ partials.rb:115:in `render_partial'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ partials.rb:143:in `render_partial_collection'     /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/ active_support/inflector.rb:257:in `each_with_index'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ partials.rb:141:in `each'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ partials.rb:141:in `each_with_index'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ partials.rb:141:in `render_partial_collection'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ base.rb:350:in `render'     app/views/trap/js.rhtml:3:in `_run_erb_47app47views47trap47js46rhtml'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ base.rb:637:in `send'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ base.rb:637:in `compile_and_render_template'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ base.rb:365:in `render_template'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ base.rb:316:in `render_file'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:1100:in `render_for_file'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:836:in `render_with_no_layout'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/layout.rb:262:in `render_without_benchmark'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/benchmarking.rb:51:in `render'     /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/benchmarking.rb:51:in `render'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:1153:in `default_render'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:1159:in `perform_action_without_filters'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/filters.rb:697:in `call_filters'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/filters.rb:689:in `perform_action_without_benchmark'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/benchmarking.rb:68:in `perform_action_without_rescue'     /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/benchmarking.rb:68:in `perform_action_without_rescue'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/rescue.rb:199:in `perform_action_without_caching'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/caching.rb:678:in `perform_action'     /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'     /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record/query_cache.rb:8:in `cache'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/caching.rb:677:in `perform_action'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:524:in `send'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:524:in `process_without_filters'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/filters.rb:685:in `process_without_session_management_support'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/session_management.rb:123:in `process'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:388:in `process'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/dispatcher.rb:171:in `handle_request'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/dispatcher.rb:115:in `dispatch' --------I cut it off here but it goes on a bit further.

thanks

jackster

Can you show us the code of the partial as well?

Hi Ryan...you're a great man to go this far into my problem....I appreciate it.

I made the code as simple as possible which should make this easier to troubleshoot.

test_it controller:    def jackster    end

RAILS_ROOT/views/test_it/jackster.rhtml:    <%= render :partial => 'sample' %>

RAILS_ROOT/views/test_it/_sample.rhtml:    Hello World

production log: Processing TestItController#jackster (for 172.21.80.102 at 2008-01-23 21:15:39) [GET]   Session ID:

BAh7CDoOcmV0dXJuX3RvMDoJdXNlcmkNIgpmbGFzaElDOidBY3Rpb25Db250%0Acm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNl

ZHsA--a9910396813648d89e0a03f35b0b15d8c1122330   Parameters: {"action"=>"jackster", "controller"=>"test_it"} Rendering template within layouts/test_it Rendering test_it/jackster

ActionView::TemplateError (wrong number of arguments (0 for 3)) on line #1 of test_it/jackster.rhtml: 1: <%= render :partial => 'sample' %>

    /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ partials.rb:115:in `logger'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ partials.rb:115:in `render_partial'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ base.rb:352:in `render'     app/views/test_it/jackster.rhtml:1:in `_run_erb_47app47views47test_it47jackster46rhtml'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ base.rb:637:in `send'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ base.rb:637:in

`compile_and_render_template'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ base.rb:365:in `render_template'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ base.rb:316:in `render_file'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:1100:in

`render_for_file'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:836:in

`render_with_no_layout'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/layout.rb:262:in

`render_without_benchmark'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/benchmarking.rb:51:in `render'     /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/benchmarking.rb:51:in `render'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:1153:in

`default_render'     /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:1159:in `perform_act

....whadaya think?

jackster

Try renaming the controller to something else other than having “Test” in its name.

It makes no difference if I rename the controller or setup the same configuration in a different controller.

I am going to dig through the partial.rb, specifically line 115 that is being flagged by the error message to see if I can determine why that script is erroring.

I will post my findings

thanks

jackster

The error message: Wrong number of arguments (0 for 3) which I showed previously points to line 115 on the following file:

/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/ partials.rb

Here is the code from that file, is there any way to tell what arguments it's looking for?

thanks jackster

# As you can see, the :locals hash is shared between both the partial and its layout.   module Partials     private       def render_partial(partial_path, object_assigns = nil, local_assigns = nil) #:nodoc:         case partial_path         when String, Symbol, NilClass           path, partial_name = partial_pieces(partial_path)           object = extracting_object(partial_name, object_assigns)           local_assigns = local_assigns ? local_assigns.clone : {}           add_counter_to_local_assigns!(partial_name, local_assigns)           add_object_to_local_assigns!(partial_name, local_assigns, object)

line 115=> if logger && logger.debug?             ActionController::Base.benchmark("Rendered #{path}/ _#{partial_name}", Logger::DEBUG, false) do               render("#{path}/_#{partial_name}", local_assigns)             end           else             render("#{path}/_#{partial_name}", local_assigns)           end

what does your config file look like?

It looks pretty basic except for the roundup method I added:

ENV['RAILS_ENV'] ||= 'production' require 'roundup' RAILS_GEM_VERSION = '2.0.2' unless defined? RAILS_GEM_VERSION

require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|

config.action_controller.session = { :session_key => "_myapp_session", :secret =

"sjd989dfksjduuoud098080980980dssdssdsd" }

config.log_level = :info

end

jackster