Tidying up rails support
This commit is contained in:
parent
62e8709df7
commit
a47de6aaf5
2 changed files with 38 additions and 44 deletions
|
@ -46,7 +46,7 @@ module CouchRest
|
|||
autoload :CastedModel, 'couchrest/more/casted_model'
|
||||
|
||||
require File.join(File.dirname(__FILE__), 'couchrest', 'mixins')
|
||||
require File.join(File.dirname(__FILE__), 'couchrest', 'support', 'rails')
|
||||
require File.join(File.dirname(__FILE__), 'couchrest', 'support', 'rails') if defined?(Rails)
|
||||
|
||||
# The CouchRest module methods handle the basic JSON serialization
|
||||
# and deserialization, as well as query parameters. The module also includes
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
# This file contains various hacks for Rails compatibility.
|
||||
|
||||
if defined?(Rails)
|
||||
|
||||
class Hash
|
||||
# Hack so that CouchRest::Document, which descends from Hash,
|
||||
# doesn't appear to Rails routing as a Hash of options
|
||||
|
@ -11,7 +8,6 @@ if defined?(Rails)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
CouchRest::Document.class_eval do
|
||||
# Need this when passing doc to a resourceful route
|
||||
alias_method :to_param, :id
|
||||
|
@ -49,5 +45,3 @@ if defined?(Rails)
|
|||
errors.values.inject(0) { |error_count, errors_for_attribute| error_count + errors_for_attribute.size }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue