[typo] Sidebar plugin help

stephen.3.odonnell at bt.com stephen.3.odonnell at bt.com
Sat Feb 10 11:18:40 EST 2007


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.



-----Original Message-----
From: typo-list-bounces at rubyforge.org on behalf of Sean
Sent: Sat 2/10/2007 04:36
To: typo-list at rubyforge.org
Subject: Re: [typo] Sidebar plugin help
 
Can you publish the exact error log? Preferably when running in
development, for added info.

Regards,

Sean

On 2/9/07, stephen.3.odonnell at bt.com <stephen.3.odonnell at bt.com> wrote:
> Guys,
>
> I think this is a bug - can anyone else reproduce?
>
> Create a simple plugin like mine below on Typo 4.0.3 and attempt to
> publish it.  That operation should fail, and an error will appear in the
> production log indicating something similar to 'unknown method each on
> object nil' (I don't have the exact message here as its on my home
> computer).
>
> Adding a single setting to the controller allows it to work, ie
>
> $ more gallerysb_controller.rb
> class Plugins::Sidebars::GallerysbController < Sidebars::ComponentPlugin
>
>   setting :foo, 'foopie'
>
>   display_name "Gallery"
>   description 'gallery stuff'
>
>   def content
>   end
> end
>
> This problem occurs on OS X
>
> Stephen.
>
> -----Original Message-----
> From: O'Donnell,S,Stephen,XMB R
> Sent: 08 February 2007 20:13
> To: typo-list at rubyforge.org
> Subject: Sidebar plugin help
>
>
> Guys,
>
> I am getting a bit stuck trying to create a Typo sidebar plugin using
> Typo 4.03.  This is my first time using Typo and I am quite new to
> Rails too, so please bear with me!
>
> I want to create a plugin called 'gallery', so I created a controller
> called gallerysb (for gallery sidebar) in components/plugins/sidebars
> and a folder called gallerysb in the directory.
>
> Inside the directory I created a directory called content.rthml
> containing the following:
>
> $ more content.rhtml
> <h3>gallery</h3>
>
> My controller contains:
>
> $ more gallerysb_controller.rb
> class Plugins::Sidebars::GallerysbController < Sidebars::ComponentPlugin
>
>   display_name "Gallery"
>   description 'gallery stuff'
>
>   def content
>   end
> end
>
> When I attempt to publish the controller, Typo just hangs and doesn't
> do it.  I can make other plugings active though (the built in ones).
>
> Can anyone point out what I am doing wrong please?
>
> Also, my plugin is going to need a model - where should I put the
> model code?  Basically I want to have my sidebar plugin that generates
> a list of available galleries, and when you click on one, it goes into
> a gallery controller which displays a page showing all the gallery
> images.  I guess the gallery should have its own controller too.
>
> Any help is greatly appreciated!
>
> Thanks,
>
> Stephen.
> _______________________________________________
> Typo-list mailing list
> Typo-list at rubyforge.org
> http://rubyforge.org/mailman/listinfo/typo-list
>
_______________________________________________
Typo-list mailing list
Typo-list at rubyforge.org
http://rubyforge.org/mailman/listinfo/typo-list

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 6307 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/typo-list/attachments/20070210/5f05b222/attachment-0001.bin 


More information about the Typo-list mailing list