Skip to content

Commit

Permalink
Updating to use couchrest_inheritable_* methods in couchrest 1.0.0.beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
samlown committed Jul 2, 2010
1 parent 64e34ee commit 2a37887
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -24,7 +24,7 @@ begin
gemspec.extra_rdoc_files = %w( README.md LICENSE THANKS.md )
gemspec.files = %w( LICENSE README.md Rakefile THANKS.md history.txt couchrest.gemspec) + Dir["{examples,lib,spec,utils}/**/*"] - Dir["spec/tmp"]
gemspec.has_rdoc = true
gemspec.add_dependency("couchrest", ">= 1.0.0.beta")
gemspec.add_dependency("couchrest", ">= 1.0.0.beta1")
gemspec.add_dependency("mime-types", ">= 1.15")
gemspec.add_dependency("activesupport", ">= 2.3.5")
gemspec.version = CouchRest::ExtendedDocument::VERSION
Expand Down
1 change: 1 addition & 0 deletions history.txt
Expand Up @@ -11,6 +11,7 @@
* Fixed issue with active_support in Rails3 and text in README for JSON.
* Refactoring of properties, added read_attribute and write_attribute methods.
* Now possible to send anything to update_attribtues method. Invalid or readonly attributes will be ignored.
* Updating to use couchrest_inheritable_attributes to avoid possible Rails conflicts

* Major enhancements
* Added support for anonymous CastedModels defined in Documents
Expand Down
2 changes: 1 addition & 1 deletion lib/couchrest/extended_document.rb
Expand Up @@ -8,7 +8,7 @@ module CouchRest
# Same as CouchRest::Document but with properties and validations
class ExtendedDocument < Document

VERSION = "1.0.0.beta5"
VERSION = "1.0.0.beta6"

include CouchRest::Mixins::Callbacks
include CouchRest::Mixins::DocumentQueries
Expand Down
6 changes: 4 additions & 2 deletions lib/couchrest/mixins/callbacks.rb
Expand Up @@ -370,6 +370,8 @@ def clone(klass)
end

module ClassMethods
extend CouchRest::InheritableAttributes

#CHAINS = {:before => :before, :around => :before, :after => :after}

# Make the _run_save_callbacks method. The generated method takes
Expand Down Expand Up @@ -497,9 +499,9 @@ def skip_callback(name, *filters, &block)
def define_callbacks(*symbols)
terminator = symbols.pop if symbols.last.is_a?(String)
symbols.each do |symbol|
extlib_inheritable_accessor("_#{symbol}_terminator") { terminator }
couchrest_inheritable_accessor("_#{symbol}_terminator") { terminator }

extlib_inheritable_accessor("_#{symbol}_callback") do
couchrest_inheritable_accessor("_#{symbol}_callback") do
CallbackChain.new(symbol)
end

Expand Down
3 changes: 2 additions & 1 deletion lib/couchrest/mixins/properties.rb
Expand Up @@ -10,7 +10,8 @@ class IncludeError < StandardError; end

def self.included(base)
base.class_eval <<-EOS, __FILE__, __LINE__ + 1
extlib_inheritable_accessor(:properties) unless self.respond_to?(:properties)
extend CouchRest::InheritableAttributes
couchrest_inheritable_accessor(:properties) unless self.respond_to?(:properties)
self.properties ||= []
EOS
base.extend(ClassMethods)
Expand Down
4 changes: 3 additions & 1 deletion lib/couchrest/validation.rb
Expand Up @@ -48,8 +48,10 @@ module CouchRest
module Validation

def self.included(base)
base.extlib_inheritable_accessor(:auto_validation)
base.class_eval <<-EOS, __FILE__, __LINE__ + 1
extend CouchRest::InheritableAttributes
couchrest_inheritable_accessor(:auto_validation)
# Callbacks
define_callbacks :validate
Expand Down

0 comments on commit 2a37887

Please sign in to comment.