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?

On Jan 23, 2008 6:34 AM, jackster.mobi [email protected] wrote:

in ROOT_RAILS/view/index.rhtml


Ryan B.
http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.

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:


3: <%= render :partial => ‘trap’, :collection => @trap %>
4:

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:inrender_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:ineach_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:ineach_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:inrender’
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:insend’
/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:inrender_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:inrender_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:inrender_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:inmeasure’
/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:indefault_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:incall_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:inperform_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:inperform_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:inperform_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:incache’
/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:insend’
/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:inprocess_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:inprocess’
/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:indispatch’
--------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?

On Jan 24, 2008 6:04 AM, jackster.mobi [email protected] wrote:

3: <%= render :partial => ‘trap’, :collection => @trap %>
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/
`_run_erb_47app47views47trap47js46rhtml’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
action_controller/benchmarking.rb:68:in
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/


Ryan B.http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.- Hide quoted text

  • Show quoted text -


Ryan B.
http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.

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:inrender_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:inrender_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:inrender’
/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:inrender’
/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:inperform_act

…whadaya think?

jackster

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

On Jan 24, 2008 12:52 PM, jackster.mobi [email protected] wrote:

21:15:39) [GET]

app/views/test_it/jackster.rhtml:1:in
base.rb:316:in `render_file’

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

…whadaya think?

jackster


Ryan B.
http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.

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

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

RAILS_ROOT/app/views/test_it/jackster.rhtml
not
RAILS_ROOT/views/test_it/jackster.rhtml

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

On Jan 24, 4:13 pm, Keynan P. [email protected]

what does your config file look like?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs