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)

iD8DBQFFQ1AM8/wfD/SBQNsRAqbzAKCp60W2WK0kOspzUZlItdcPu2RPhwCgs0y6
HBkm5bH4de/a/EbPdoI3AOg=
=2tK1
-----END PGP SIGNATURE-----

Le,

The current, correct way is to install it as a plugin:

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

I don’t think that’s the problem, though. It seems to be happening on
the “children” association. How did you set up your database?

Sean

Hi Sean,
I am getting a similar error
Validation failed: Status must be a number

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

#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/validations.rb:748:in
save!' #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/validations.rb:711:increate!’
#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb:102:in
send' #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb:102:inmethod_missing’
#{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/base.rb:873:in
with_scope' #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb:92:inmethod_missing’
#{RAILS_ROOT}/app/behaviors/comments_util.rb:23:in create_comment_in' #{RAILS_ROOT}/app/behaviors/comment_bucket_behavior.rb:21:inprocess’
#{RAILS_ROOT}/lib/advanced_delegation.rb:10:in send' #{RAILS_ROOT}/lib/advanced_delegation.rb:10:inprocess’
#{RAILS_ROOT}/app/controllers/site_controller.rb:36:in
show_uncached_page' #{RAILS_ROOT}/app/controllers/site_controller.rb:22:inshow_page’

I used
% script/setup_database development to set up my database (mysql)

any thoughts
cheers
jsp

Sorry that you are experiencing that problem. I have been tied up with
personal and professional issues and haven’t looked at the code in a
while. I’ll check on that problem for you as soon as I can.

Sean

Hi Sean/Robert
Found a quick work around

followed your instructions in

http://seancribbs.com/tech/2006/09/01/return-of-the-comments/

and changed the defaults in the ‘Config’ part of the comments util

it now works fine

nb :status => “100” got the same error as above
:status => 100 works perfectly

cheers
jsp