Re: Sidebar plugin help


#1

OK - here is error log while running in development mode:

Create a controller:

class Plugins::Sidebars::GallerysbController < Sidebars::ComponentPlugin
display_name “Gallery”
description ‘Stuff from the gallery’

setting :pie, ‘foopie’

def content
nil
end
def config
nil
end
end

Note that there are not settings defined. Now attempt to make the
plugin active, after clicking publish changes the following appears in
the development log:

Processing SidebarController#publish (for 192.168.0.48 at 2007-02-10
16:10:18) [POST]
Session ID: 747c57e83bcf016db9dfa9ecffb073b6
Parameters: {“action”=>“publish”, “configure”=>{“1”=>{“empty”=>“0”,
“count”=>“1”}, “2”=>{“body”=>"

\n", "title"=>"Links"}}, "controller"=>"admin/sidebar"} Blog Load (0.000606) SELECT * FROM blogs ORDER BY id LIMIT 1 Trigger Load (0.000387) SELECT * FROM triggers WHERE (due_at <= '2007-02-10 16:10:18') SQL (0.000468) SELECT version FROM schema_info Sidebar Update (0.000979) UPDATE sidebars SET active_position = null Sidebar Load (0.000603) SELECT * FROM sidebars WHERE (sidebars.id = 1) LIMIT 1 SQL (0.001441) PRAGMA table_info(sidebars) Sidebar Update (0.000405) UPDATE sidebars SET "controller" = 'category', "active_position" = 0, "staged_position" = NULL, "config" = '--- !map:HashWithIndifferentAccess empty: false count: "1" ' WHERE id = 1 Sidebar Load (0.000581) SELECT * FROM sidebars WHERE (sidebars.id = 2) LIMIT 1 Sidebar Update (0.000292) UPDATE sidebars SET "controller" = 'static', "active_position" = 1, "staged_position" = NULL, "config" = '--- !map:HashWithIndifferentAccess title: Links body: |

’ WHERE id = 2
Sidebar Load (0.000539) SELECT * FROM sidebars WHERE (sidebars.id =
3) LIMIT 1

NoMethodError (You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.each):
/app/controllers/admin/sidebar_controller.rb:60:in publish' /app/controllers/admin/sidebar_controller.rb:55:inpublish’
/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:51:in
transaction' /vendor/rails/activerecord/lib/active_record/transactions.rb:91:intransaction’
/app/controllers/admin/sidebar_controller.rb:51:in publish' /vendor/rails/actionpack/lib/action_controller/base.rb:941:inperform_action_without_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:368:in
perform_action_without_benchmark' /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
/usr/local/lib/ruby/1.8/benchmark.rb:293:in measure' /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
/vendor/rails/actionpack/lib/action_controller/rescue.rb:82:in
perform_action' /vendor/rails/actionpack/lib/action_controller/base.rb:408:inprocess_without_filters’
/vendor/rails/actionpack/lib/action_controller/filters.rb:377:in
process_without_session_management_support' /vendor/rails/actionpack/lib/action_controller/session_management.rb:117:inprocess’
/vendor/rails/railties/lib/dispatcher.rb:38:in dispatch' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb:84:inprocess’
/usr/local/lib/ruby/1.8/sync.rb:229:in synchronize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb:83:inprocess’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:580:in
process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:579:inprocess_client’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in
run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:inrun’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:in
run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/configurator.rb:267:inrun’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/configurator.rb:266:in
run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:127:inrun’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/command.rb:211:in
`run’
/usr/local/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:231
/usr/local/bin/mongrel_rails:18

SQL (0.003495) PRAGMA table_info(users)
Rendering
/Users/james/rails/typo_test/config/…/vendor/rails/actionpack/lib/action_controller/templates/rescues/layout.rhtml
(500 Internal Error)

Uncommenting the setting in the controller allows everthing to work
correctly.

Cheers,

Stephen.