mrbrdo/has_moderated — Issue #5: Cannot edit/create model..
Author: lephyrius
Created: 2012-01-12 20:59:42+00:00
State: open

When I try to both edit/create model I get this error:
I just use this code:
has_moderated :name
And get this error:
´´´
PGError: ERROR: null value in column "moderatable_type" violates not-null constraint
: INSERT INTO "moderations" ("attr_name", "attr_value", "created_at", "moderatable_id", "moderatable_type", "updated_at", "user_id") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"
´´´

´´´
activerecord (3.1.3) lib/active_record/connection_adapters/postgresql_adapter.rb:1034:in `get_last_result'
activerecord (3.1.3) lib/active_record/connection_adapters/postgresql_adapter.rb:1034:in `exec_cache'
activerecord (3.1.3) lib/active_record/connection_adapters/postgresql_adapter.rb:603:in `block in exec_query'
activerecord (3.1.3) lib/active_record/connection_adapters/abstract_adapter.rb:244:in `block in log'
activesupport (3.1.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activerecord (3.1.3) lib/active_record/connection_adapters/abstract_adapter.rb:239:in `log'
activerecord (3.1.3) lib/active_record/connection_adapters/postgresql_adapter.rb:601:in `exec_query'
activerecord (3.1.3) lib/active_record/connection_adapters/abstract/database_statements.rb:63:in `exec_insert'
activerecord (3.1.3) lib/active_record/connection_adapters/abstract/database_statements.rb:90:in `insert'
activerecord (3.1.3) lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert'
activerecord (3.1.3) lib/active_record/relation.rb:70:in `insert'
activerecord (3.1.3) lib/active_record/persistence.rb:313:in `create'
activerecord (3.1.3) lib/active_record/timestamp.rb:51:in `create'
activerecord (3.1.3) lib/active_record/callbacks.rb:268:in `block in create'
activesupport (3.1.3) lib/active_support/callbacks.rb:390:in `_run_create_callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
activerecord (3.1.3) lib/active_record/callbacks.rb:268:in `create'
activerecord (3.1.3) lib/active_record/persistence.rb:294:in `create_or_update'
activerecord (3.1.3) lib/active_record/callbacks.rb:264:in `block in create_or_update'
activesupport (3.1.3) lib/active_support/callbacks.rb:399:in `_run_save_callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
activerecord (3.1.3) lib/active_record/callbacks.rb:264:in `create_or_update'
activerecord (3.1.3) lib/active_record/persistence.rb:57:in `save!'
activerecord (3.1.3) lib/active_record/validations.rb:56:in `save!'
activerecord (3.1.3) lib/active_record/attribute_methods/dirty.rb:33:in `save!'
activerecord (3.1.3) lib/active_record/transactions.rb:246:in `block in save!'
activerecord (3.1.3) lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
activerecord (3.1.3) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
activerecord (3.1.3) lib/active_record/transactions.rb:208:in `transaction'
activerecord (3.1.3) lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
activerecord (3.1.3) lib/active_record/transactions.rb:246:in `save!'
has_moderated (0.0.28) lib/has_moderated/common.rb:11:in `create_moderation_with_hooks!'
has_moderated (0.0.28) lib/has_moderated/moderated_attributes.rb:65:in `block in to_moderation'
has_moderated (0.0.28) lib/has_moderated/moderated_attributes.rb:57:in `each_pair'
has_moderated (0.0.28) lib/has_moderated/moderated_attributes.rb:57:in `to_moderation'
has_moderated (0.0.28) lib/has_moderated/moderated_attributes.rb:33:in `block in has_moderated'
activesupport (3.1.3) lib/active_support/callbacks.rb:449:in `_run_save_callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
activerecord (3.1.3) lib/active_record/callbacks.rb:264:in `create_or_update'
has_moderated (0.0.28) lib/has_moderated/moderated_create.rb:26:in `create_or_update_with_moderation'
activerecord (3.1.3) lib/active_record/persistence.rb:37:in `save'
activerecord (3.1.3) lib/active_record/validations.rb:50:in `save'
activerecord (3.1.3) lib/active_record/attribute_methods/dirty.rb:22:in `save'
activerecord (3.1.3) lib/active_record/transactions.rb:241:in `block (2 levels) in save'
activerecord (3.1.3) lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
activerecord (3.1.3) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
activerecord (3.1.3) lib/active_record/transactions.rb:208:in `transaction'
activerecord (3.1.3) lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
activerecord (3.1.3) lib/active_record/transactions.rb:241:in `block in save'
activerecord (3.1.3) lib/active_record/transactions.rb:252:in `rollback_active_record_state!'
activerecord (3.1.3) lib/active_record/transactions.rb:240:in `save'
activerecord (3.1.3) lib/active_record/persistence.rb:163:in `block in update_attributes'
activerecord (3.1.3) lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
activerecord (3.1.3) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
activerecord (3.1.3) lib/active_record/transactions.rb:208:in `transaction'
activerecord (3.1.3) lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
activerecord (3.1.3) lib/active_record/persistence.rb:161:in `update_attributes'
actionpack (3.1.3) lib/action_controller/metal/mime_responds.rb:269:in `call'
actionpack (3.1.3) lib/action_controller/metal/mime_responds.rb:269:in `retrieve_response_from_mimes'
actionpack (3.1.3) lib/action_controller/metal/mime_responds.rb:194:in `respond_to'
actionpack (3.1.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.1.3) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.1.3) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.1.3) lib/active_support/callbacks.rb:434:in `_run__1306599932066536266__process_action__966822088191402576__callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:386:in `_run_process_action_callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.1.3) lib/active_support/notifications.rb:53:in `block in instrument'
activesupport (3.1.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.1.3) lib/active_support/notifications.rb:53:in `instrument'
actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/params_wrapper.rb:201:in `process_action'
activerecord (3.1.3) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
´´´

Any idea what it could be?