Problem with 'commentable'; was "Re: RadiantCMS, Maple Leaf

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 28-okt-2006, at 13:47, Sean C. wrote:

It has that already, albeit a somewhat kludgy implementation. Check out Commentable on the wiki under ThirdPartyBehaviors.

Sean C.
seancribbs.com

Sean (or anyone),

I’m currently testing the commentable behavior. I added the files to
the app/behaviors dir. Although the comment form appears as it
should in an article page, but when I submit a comment I receive the
below error (my apologies for the enormous amount of text, but I
didn’t which part you’d need). The articles are set to ‘commentable’,
the snippet was made and inserted in the layout with <r:snippet
name=“comments” />. I just working my way through “Programming Ruby”
and “Agile web development …” so I’m quite new to Ruby (on Rails)
and probably missing something simple…

+++++++++++++++++++++++++++++++++++++
ActiveRecord::RecordInvalid in SiteController#show_page

Validation failed: Status must be a number, Status must be a number

RAILS_ROOT: script/…/config/…
Application Trace | Framework Trace | Full Trace

vendor/rails/activerecord/lib/active_record/validations.rb:748:in
save!' vendor/rails/activerecord/lib/active_record/validations.rb:711:in create!’
vendor/rails/activerecord/lib/active_record/associations/
has_many_association.rb:102:in send' vendor/rails/activerecord/lib/active_record/associations/ has_many_association.rb:102:in method_missing’
vendor/rails/activerecord/lib/active_record/base.rb:873:in with_scope' vendor/rails/activerecord/lib/active_record/associations/ has_many_association.rb:92:in method_missing’
app/behaviors/comments_util.rb:23:in create_comment_in' app/behaviors/commentable_behavior.rb:34:in process’
#{RAILS_ROOT}/lib/advanced_delegation.rb:10:in send' #{RAILS_ROOT}/lib/advanced_delegation.rb:10:in process’
app/controllers/site_controller.rb:36:in show_uncached_page' app/controllers/site_controller.rb:22:in show_page’

vendor/rails/activerecord/lib/active_record/validations.rb:748:in
save!' vendor/rails/activerecord/lib/active_record/validations.rb:711:in create!’
vendor/rails/activerecord/lib/active_record/associations/
has_many_association.rb:102:in send' vendor/rails/activerecord/lib/active_record/associations/ has_many_association.rb:102:in method_missing’
vendor/rails/activerecord/lib/active_record/base.rb:873:in with_scope' vendor/rails/activerecord/lib/active_record/associations/ has_many_association.rb:92:in method_missing’
vendor/rails/actionpack/lib/action_controller/base.rb:941:in send' 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 send’
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’
vendor/rails/railties/lib/webrick_server.rb:115:in handle_dispatch' vendor/rails/railties/lib/webrick_server.rb:81:in service’
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in run’
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in start’
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:95:in start’
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in each' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in start’
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:82:in start’
vendor/rails/railties/lib/webrick_server.rb:67:in dispatch' vendor/rails/railties/lib/commands/servers/webrick.rb:59 vendor/rails/activesupport/lib/active_support/dependencies.rb:147:in require’
vendor/rails/activesupport/lib/active_support/dependencies.rb:147:in
require' vendor/rails/railties/lib/commands/server.rb:30 script/server:3:in require’
script/server:3

vendor/rails/activerecord/lib/active_record/validations.rb:748:in
save!' vendor/rails/activerecord/lib/active_record/validations.rb:711:in create!’
vendor/rails/activerecord/lib/active_record/associations/
has_many_association.rb:102:in send' vendor/rails/activerecord/lib/active_record/associations/ has_many_association.rb:102:in method_missing’
vendor/rails/activerecord/lib/active_record/base.rb:873:in with_scope' vendor/rails/activerecord/lib/active_record/associations/ has_many_association.rb:92:in method_missing’
app/behaviors/comments_util.rb:23:in create_comment_in' app/behaviors/commentable_behavior.rb:34:in process’
#{RAILS_ROOT}/lib/advanced_delegation.rb:10:in send' #{RAILS_ROOT}/lib/advanced_delegation.rb:10:in process’
app/controllers/site_controller.rb:36:in show_uncached_page' app/controllers/site_controller.rb:22:in show_page’
vendor/rails/actionpack/lib/action_controller/base.rb:941:in send' 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 send’
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’
vendor/rails/railties/lib/webrick_server.rb:115:in handle_dispatch' vendor/rails/railties/lib/webrick_server.rb:81:in service’
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in run’
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in start’
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:95:in start’
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in each' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in start’
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:82:in start’
vendor/rails/railties/lib/webrick_server.rb:67:in dispatch' vendor/rails/railties/lib/commands/servers/webrick.rb:59 vendor/rails/activesupport/lib/active_support/dependencies.rb:147:in require’
vendor/rails/activesupport/lib/active_support/dependencies.rb:147:in
require' vendor/rails/railties/lib/commands/server.rb:30 script/server:3:in require’
script/server:3

Request

Parameters: {“name”=>“robert”, “title”=>“comment”, “body”=>“this is a
comment”, “url”=>[“articles”, “2006”, “06”, “09”, “first-post”]}

Show session dump


Response
Headers: {“cookie”=>[]}
+++++++++++++++++++++++++++++++++++++

Thanks,

Robert.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFFQ09etKX8OBbKsDMRAskwAJ9FY+u75VUwpe21LBwlA20pNg7OLwCeJUmU
PmAAIovTs30KxDaSsCSAMHw=
=/VT6
-----END PGP SIGNATURE-----

Robert,

Add a “config” part to the pages on which it is failing and put this
line in that part:

status: 1

That line with make all comments be posted in “Draft” mode. By the way,
the proper way to install Commentable is as a plugin. Run this from the
command line in the root of your Radiant application:

ruby script/plugin install
http://seancribbs.com/svn/rails/plugins/comments_behaviors

In the next few weeks I’ll be porting Commentable to the new sexy
extensions system. So all you kids playing with the mental branch can
have a new and improved Commentable!

Sean

p.s. If you continue to have problems with the behaviors, please email
me privately.