[RCBC-85] undefined method `default' for Class Created: 26/Sep/12  Updated: 13/Nov/12  Resolved: 26/Sep/12

Status: Closed
Project: Couchbase Ruby client library
Component/s: None
Affects Version/s: 1.2.0.z.beta
Fix Version/s: None
Security Level: Public

Type: Bug Priority: Critical
Reporter: Patrick Assignee: Sergey Avseyev
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment: Mac OS 10.8.1
ruby 1.9.3p194
Rails 3.2.8


 Description   
When using 'save' on an existing and previously saved document, there's a 'undefined method'-error on 'default'. 'save' and 'update' result in the same error.

class TestDoc < Couchbase::Model
  attribute :email, :default => ''
  attribute :created_at, :default => lambda { Time.zone.now }
  
  view :by_created_at
end

t = TestDoc.new(:id => request.session_options[:id])
t.save
t = TestDoc.find(request.session_options[:id])
t.email = 'hello'
t.update(:email => 'blubb')

undefined method `default' for TestDoc(id, email, created_at):Class

couchbase-model (0.4.0) lib/couchbase/model.rb:487:in `save'
(eval):4:in `block in save'
activesupport (3.2.8) lib/active_support/callbacks.rb:403:in `_run__3218406879367123135__save__4511417429032474671__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
(eval):3:in `save'
couchbase-model (0.4.0) lib/couchbase/model.rb:501:in `update'
(eval):4:in `block in update'
activesupport (3.2.8) lib/active_support/callbacks.rb:403:in `_run__3218406879367123135__update__4511417429032474671__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_update_callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
(eval):3:in `update'

 Comments   
Comment by Sergey Avseyev [ 26/Sep/12 ]
http://review.couchbase.org/21123
Generated at Thu Aug 28 07:54:38 CDT 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.