Hi,
First of all - THANKS for a great piece of code. Truly helpful to get
things off the ground - and even as the final interface.
I have just started using the virtual column definitions, and today
encountered a create bug.
I have a company_controller - and in its model I have defined a method
like:
def total_investment_by_company
conditions = "company_id = '#{
self.id}'"
Investment.find_by_conditions(conditions).sum {|
investment| investment.amount}
end
This works great for list actions etc etc, but when I create a new
element using the "Create New" I get the error log included below.
Is this indeed a BUG or did I goof it up ?
/S
Processing CompanyController#create (for 192.168.0.200 at 2008-02-01
17:41:55) [POST]
Session ID: 4d26902f509b967f63d9c960970d852f
Parameters: {"commit"=>"Create", "action"=>"create",
"controller"=>"company", "associated_id"=>"2",
"record"=>{"name"=>"xyz", "city"=>"", "www"=>"", "zip"=>"",
"contact"=>{"city"=>"", "name"=>"", "company"=>"", "skype"=>"",
"www"=>"", "zip"=>"", "title"=>"", "country"=>"", "im"=>"",
"mobile"=>"", "phone"=>"", "address"=>"", "email"=>""}, "country"=>"",
"phone"=>"", "fax"=>"", "address"=>"", "fund"=>{"name"=>"XXX",
"id"=>"2"}, "total_investment_by_company"=>"0"}}
Fund Columns (0.000395) SHOW FIELDS FROM funds
Contact Columns (0.000758) SHOW FIELDS FROM contacts
SQL (0.000061) BEGIN
Fund Load (0.000149) SELECT * FROM funds WHERE (funds.`id` = 2)
Investment Load (0.000198) SELECT * FROM investments WHERE
(company_id = '')
SQL (0.000061) ROLLBACK
NoMethodError (undefined method `total_investment_by_company=' for
#<Company:0x2b018f196728>):
/usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/base.rb:1857:in `method_missing'
.//vendor/plugins/active_scaffold/lib/attribute_params.rb:106:in
`send'
.//vendor/plugins/active_scaffold/lib/attribute_params.rb:106:in
`update_record_from_params'
.//vendor/plugins/active_scaffold/lib/data_structures/
action_columns.rb:68:in `each'
.//vendor/plugins/active_scaffold/lib/data_structures/
action_columns.rb:55:in `each'
.//vendor/plugins/active_scaffold/lib/attribute_params.rb:49:in
`update_record_from_params'
.//vendor/plugins/active_scaffold/lib/actions/create.rb:73:in
`do_create'
/usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/abstract/database_statements.rb:
59:in `transaction'
/usr/lib64/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/transactions.rb:95:in `transaction'
.//vendor/plugins/active_scaffold/lib/actions/create.rb:72:in
`do_create'
.//vendor/plugins/active_scaffold/lib/actions/create.rb:28:in
`create'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:1095:in `send'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:1095:in `perform_action_without_filters'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:632:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:638:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:438:in `call'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:637:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:638:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:438:in `call'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:637:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:634:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:638:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:438:in `call'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:637:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:634:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:638:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:438:in `call'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:637:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:638:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:438:in `call'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:637:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:638:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:438:in `call'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:637:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:638:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:438:in `call'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:637:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:638:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:438:in `call'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:637:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:638:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:449:in `call'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:637:in `call_filter'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:619:in `perform_action_without_benchmark'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/benchmarking.rb:66:in
`perform_action_without_rescue'
/usr/lib64/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/benchmarking.rb:66:in
`perform_action_without_rescue'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/rescue.rb:83:in `perform_action'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:430:in `send'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:430:in `process_without_filters'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/filters.rb:624:in
`process_without_session_management_support'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/session_management.rb:114:in `process'
/usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:330:in `process'
/usr/lib64/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:41:in
`dispatch'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/
rails.rb:84:in `process'
/usr/lib64/ruby/1.8/sync.rb:229:in `synchronize'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/
rails.rb:83:in `process'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:
580:in `process_client'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:
579:in `each'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:
579:in `process_client'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:
686:in `run'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:
686:in `initialize'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:
686:in `new'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:
686:in `run'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:
673:in `initialize'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:
673:in `new'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:
673:in `run'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/
configurator.rb:267:in `run'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/
configurator.rb:266:in `each'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/
configurator.rb:266:in `run'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:
127:in `run'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/
command.rb:211:in `run'
/usr/lib64/ruby/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:
231
/usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/dependencies.rb:488:in `load'
/usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/dependencies.rb:488:in `load'
/usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/dependencies.rb:342:in `new_constants_in'
/usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/dependencies.rb:488:in `load'
/usr/lib64/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/servers/
mongrel.rb:60
/usr/lib64/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
/usr/lib64/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
/usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/dependencies.rb:495:in `require'
/usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/dependencies.rb:342:in `new_constants_in'
/usr/lib64/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/dependencies.rb:495:in `require'
/usr/lib64/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/server.rb:
39
/usr/lib64/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
/usr/lib64/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
script/server:3
Rendering /usr/lib64/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/templates/rescues/layout.rhtml (500 Internal Error)