Forum: Typo Re: Sidebar plugin help

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Efc06b7a0442260a2198dedd661b54d2?d=identicon&s=25 unknown (Guest)
on 2007-02-10 18:48
(Received via mailing list)
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"=>"<ul>\n  <li><a
href=\"http://www.typosphere.org\" title=\"Typo\">Typo</a></li>\n
<li><a href=\"http://blog.leetsoft.com\"
title=\"too-biased\">too-biased</a></li>\n  <li><a
href=\"http://www.poocs.net/\" title=\"poocs.net\">poocs.net</a></li>\n
<li><a href=\"http://blog.remor.com/\" title=\"seth hall\">Seth
Hall</a></li>\n  <li><a href=\"http://encytemedia.com\" title=\"Encyte
Media\">EncyteMedia</a></li>\n  <li><a href=\"http://scottstuff.net\"
title=\"Scottstuff\">scottstuff.net</a></li>\n  <li><a
href=\"http://www.bofh.org.uk\" title=\"Just a Summary\">Just A
Summary</a></li>\n  <li><a href=\"http://nubyonrails.com\"
title=\"Topfunky\">Topfunky</a></li>\n  <li><a
href=\"http://planettypo.com\"
title=\"PlanetTypo\">PlanetTypo</a></li>\n  <li><a
href=\"http://typoforums.org\" title=\"Typo Forums\">Typo
Forums</a></li>\n</ul>\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: |
 <ul>
 <li><a href="http://www.typosphere.org" title="Typo">Typo</a></li>
 <li><a href="http://blog.leetsoft.com"
title="too-biased">too-biased</a></li>
 <li><a href="http://www.poocs.net/"
title="poocs.net">poocs.net</a></li>
 <li><a href="http://blog.remor.com/" title="seth hall">Seth
Hall</a></li>
 <li><a href="http://encytemedia.com" title="Encyte
Media">EncyteMedia</a></li>
 <li><a href="http://scottstuff.net"
title="Scottstuff">scottstuff.net</a></li>
 <li><a href="http://www.bofh.org.uk" title="Just a Summary">Just A
Summary</a></li>
 <li><a href="http://nubyonrails.com" title="Topfunky">Topfunky</a></li>
 <li><a href="http://planettypo.com"
title="PlanetTypo">PlanetTypo</a></li>
 <li><a href="http://typoforums.org" title="Typo Forums">Typo
Forums</a></li>
 </ul>

' 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:in `publish'
    /vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:51:in
`transaction'
    /vendor/rails/activerecord/lib/active_record/transactions.rb:91:in
`transaction'
    /app/controllers/admin/sidebar_controller.rb:51:in `publish'
    /vendor/rails/actionpack/lib/action_controller/base.rb:941:in
`perform_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:in
`perform_action_without_rescue'
    /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in
`perform_action_without_rescue'
    /vendor/rails/actionpack/lib/action_controller/rescue.rb:82:in
`perform_action'
    /vendor/rails/actionpack/lib/action_controller/base.rb:408:in
`process_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:in
`process'
    /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:in
`process'
    /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:in
`process'
    /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:in
`process_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:in
`run'
    /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:in
`run'
    /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:in
`run'
    /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.
This topic is locked and can not be replied to.