Uploaded image for project: 'Couchbase Ruby client library'
  1. Couchbase Ruby client library
  2. RCBC-85

undefined method `default' for Class

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • None
    • 1.2.0.z.beta
    • None
    • Security Level: Public
    • None
    • 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 `run3218406879367123135save4511417429032474671_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 `run3218406879367123135update4511417429032474671_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'

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            avsej Sergey Avseyev
            Pathe Patrick
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty