Replace_html not working


#1

hallo, everyone

can anybody help me? i did add my code under ENGINES as a module in a
project. before the change , all worked . and the differenz between
both is only about application’s environment,
before is

Ruby version 1.8.6 (i486-linux)
RubyGems version 1.1.1
Rails version 2.0.2
Active Record version 2.0.2
Action Pack version 2.0.2
Active Resource version 2.0.2
Action Mailer version 2.0.2
Active Support version 2.0.2
Application root /home/kiki/workspace/xxx
Environment development
Database adapter mysql
Database schema version 0

now is

Ruby version 1.8.6 (i486-linux)
RubyGems version 1.1.1
Rails version 2.1.0
Active Record version 2.1.0
Action Pack version 2.1.0
Active Resource version 2.1.0
Action Mailer version 2.1.0
Active Support version 2.1.0
Application root /home/kiki/workspace/xxxx/
Environment development
Database adapter sqlite3
Database schema version 0

and now all function about replace of page not working . maybe the under
informations is helpable.

tail -f log/development.log

/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/configurator.rb:282:in

run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/configurator.rb:281:ineach’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/…/lib/mongrel/configurator.rb:281:in
run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/mongrel_rails:128:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/…/lib/mongrel/command.rb:212:in
run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/mongrel_rails:281 /usr/bin/mongrel_rails:19:inload’
/usr/bin/mongrel_rails:19

Rendering
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/templates/rescues/layout.erb
(internal_server_error)

and the information , when i select a month .

Processing AccountsController#filtered_balances_for_a_month (for
127.0.0.1 at 2008-10-14 13:05:31) [POST]
Session ID:
BAh7CToUcmV0dXJuX2xvY2F0aW9uQzoeSGFzaFdpdGhJbmRpZmZlcmVudEFj
Y2Vzc3sJIgxzaXRlX2lkIgYyIgthY3Rpb24iCXNob3ciB2lkIgYxIg9jb250
cm9sbGVyIhBhZG1pbi91c2VyczoMY3NyZl9pZCIlOWIyNWYwMzk5ZmFiMjZh
MjhiNmNhMDBhNDkyY2NhNjU6CHVpZGkGIgpmbGFzaElDOidBY3Rpb25Db250
cm9sbGVyOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA–1a0684d271aa6103b52dbc61c4ad7560443a7f6e
Parameters: {“commit”=>“Filter balances for a month”,
“chartofaccount_id”=>“1”,
“authenticity_token”=>“388f45d590a6a0692313241db3f16ee5a5b3b896”,
“action”=>“filtered_balances_for_a_month”,
“filter”=>{“month(1i)”=>“2008”, “month(2i)”=>“9”, “month(3i)”=>“1”},
“controller”=>“accounts”}
Chartofaccount Load (0.000290) SELECT * FROM “chartofaccounts” WHERE
(“chartofaccounts”.“id” = 1)
Account Load (0.001298) SELECT * FROM “accounts” WHERE
(chartofaccount_id=1) ORDER BY code ASC

ArgumentError (tried to create Proc object without a block):
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/object/extending.rb:46:in
define_method' /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/object/extending.rb:46:ininstance_exec’
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/object/extending.rb:46:in
module_eval' /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/object/extending.rb:46:ininstance_exec’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/helpers/prototype_helper.rb:581:in
initialize' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:913:innew’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:913:in
render_with_no_layout' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/layout.rb:259:inrender_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:51:in
render_without_error_proc' /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/benchmark.rb:8:inrealtime’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:51:in
render_without_error_proc' /vendor/plugins/render_with_error_proc/lib/action_controller/render_with_error_proc.rb:26:inrender’
/vendor/plugins/render_with_error_proc/lib/action_controller/render_with_error_proc.rb:45:in
with_error_proc' /vendor/plugins/render_with_error_proc/lib/action_controller/render_with_error_proc.rb:25:inrender’
/vendor/engines/adva_pac/app/controllers/accounts_controller.rb:225:in
filtered_balances_for_a_month' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:insend’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in
perform_action_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:580:incall_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:573:in
perform_action_without_benchmark' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:inperform_action_without_rescue’
/usr/lib/ruby/1.8/benchmark.rb:293:in measure' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:inperform_action_without_rescue’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/rescue.rb:201:in
perform_action_without_caching' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:13:inperform_action’
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in
cache' /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/query_cache.rb:8:incache’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:12:in
perform_action' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:insend’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in
process_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:569:inprocess_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session_management.rb:130:in
process' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:389:inprocess’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:149:in
handle_request' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:107:indispatch’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in
synchronize' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:indispatch’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:120:in
dispatch_cgi' /usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:35:indispatch’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/…/lib/mongrel/rails.rb:76:in
process' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/rails.rb:74:insynchronize’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/…/lib/mongrel/rails.rb:74:in
process' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel.rb:159:inprocess_client’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/…/lib/mongrel.rb:158:in
each' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel.rb:158:inprocess_client’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/…/lib/mongrel.rb:285:in
run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel.rb:285:ininitialize’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/…/lib/mongrel.rb:285:in
new' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel.rb:285:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/…/lib/mongrel.rb:268:in
initialize' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel.rb:268:innew’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/…/lib/mongrel.rb:268:in
run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/configurator.rb:282:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/…/lib/mongrel/configurator.rb:281:in
each' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/configurator.rb:281:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/mongrel_rails:128:in
run' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/../lib/mongrel/command.rb:212:inrun’
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.4/bin/mongrel_rails:281
/usr/bin/mongrel_rails:19:in `load’
/usr/bin/mongrel_rails:19

Rendering
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/templates/rescues/layout.erb
(internal_server_error)


#2

Kiki Kiki wrote:

hallo, everyone
(internal_server_error)

hai kiki
could you post that coding part here ?
it may be helpful


#3

Pokkai D. wrote:

Kiki Kiki wrote:

hallo, everyone
(internal_server_error)

hai kiki
could you post that coding part here ?
it may be helpful

because i have used moret times replace , and all workde before, don’t
working now. so i think , maybe only something about environment is
wrong, maybe. i don’t know.


#4

and show in Firebug

ArgumentError

in AccountsController#filtered_balances_for_a_month
tried to create Proc object without a block

RAILS_ROOT: /home/lihui/workspace/adva_cms/adva_cms

<a href="#" 

onclick="document.getElementById(‘Framework-Trace’).style.display=‘none’;document.getElementById

(‘Full-Trace’).style.display=‘none’;document.getElementById(‘Application-Trace’).style.display=‘block’

;; return false;">Application Trace |

<a href="#" 

onclick="document.getElementById(‘Application-Trace’).style.display=‘none’;document.getElementById

(‘Full-Trace’).style.display=‘none’;document.getElementById(‘Framework-Trace’).style.display=‘block’

;; return false;">Framework Trace |

<a href="#" 

onclick="document.getElementById(‘Application-Trace’).style.display=‘none’;document.getElementById

(‘Framework-Trace’).style.display=‘none’;document.getElementById(‘Full-Trace’).style.display=‘block’

;; return false;">Full Trace

<div id="Application-Trace" style="display: block;">

#5

Pokkai D. wrote:

Kiki Kiki wrote:

hallo, everyone
(internal_server_error)

hai kiki
could you post that coding part here ?
it may be helpful

1.in View with name :list_of_balances.html.erb
<% form_remote_tag(:url =>
filtered_balances_for_a_month_admin_accounts_path(@chart)) do %>

please select a month : <%= date_select :filter, :month, :order => [:month,:year], :add_month_numbers => true %> <%= submit_tag "Filter balances for a month" %>

<% end %>
<%= render :partial => "balances", :locals => {:month => Date.today,:begin_date => @begin_date, :end_date => @end_date}%>
  1. in Views with name : _balances.html.erb
<% for account in @accounts %> ;">

<% if account.debit_sum_between(begin_date,end_date).to_f >
account.credit_sum_between(begin_date,end_date).to_f%>


<% else %>


<% end %> <% end %>
<%=h 'account code'%> <%=h 'account name'%> <%=h 'debit balance'%> <%=h 'credit balance'%>
<%=h account.code%> <%=h account.name%> <%=h account.debit_sum_between(begin_date, end_date).to_f -
account.credit_sum_between(begin_date,end_date).to_f %>
<%=h ‘0.0’%> <%=h account.credit_sum_between(begin_date, end_date).to_f -
account.debit_sum_between(begin_date,end_date).to_f %>
  1. controller File with name accounts_controller.rb
    class AccountsController < ApplicationController
    layout “pac”

before_filter :find_chart

def find_chart
@chart = Chartofaccount.find(params[:chartofaccount_id])
end

def list_of_balances
@accounts = Account.find(:all , :order => [‘code ASC’],:conditions
=> [‘chartofaccount_id=?’,@chart])
date = Date.today
@begin_date = date.beginning_of_month
@end_date = date.end_of_month
end

def filtered_balances_for_a_month
@date =
Date.new(params[:filter][“month(1i)”].to_i,params[:filter][“month(2i)”].to_i,1)
@begin_date = @date.beginning_of_month
@end_date = @date.end_of_month

@accounts = Account.find(:all , :order => ['code ASC'],:conditions 

=> [‘chartofaccount_id=?’,@chart])

# with p @date , i can know ,here working
render :update do |page|
  page.replace_html(:balances, :partial => "balances", :locals => 

{:begin_date => @begin_date, :end_date => @end_date})
end
end
end

4 routes.rb

define of ‘admin’ is from colleague

map.connect ‘admin’, :controller => ‘admin/sites’,
:action => ‘index’,
:requirements => { :method => :get }

this is from my routes

map.resources :chartofaccounts, :member => { :import_accounts => :get
},
:controller => ‘chartofaccounts’,
:path_prefix => ‘admin’,
:name_prefix => ‘admin_’
map.resources :accounts, :controller => ‘accounts’,
:path_prefix =>
‘admin/chartofaccounts/:chartofaccount_id’,
:name_prefix => ‘admin_’ ,

                       :collection => {:list_of_balances => :get,
                                       :filtered_balances_for_a_month 

=> :post}

if other is helpful , tell me please. and thanks .