Class: GoodTimes
- Inherits:
-
CouchRest::Document
- Object
- CouchRest::Document
- GoodTimes
- Includes:
- DesignDocHelper
- Defined in:
- lib/good_times.rb,
lib/good_times/version.rb
Constant Summary collapse
- VERSION =
'0.0.1'
Class Method Summary collapse
- .get(id) ⇒ Object
-
.query(method, view, options) ⇒ Object
alias :find :get.
Methods included from DesignDocHelper
Class Method Details
.get(id) ⇒ Object
27 28 29 |
# File 'lib/good_times.rb', line 27 def get(id) new database.get(id) rescue nil end |
.query(method, view, options) ⇒ Object
alias :find :get
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/good_times.rb', line 14 def query(method, view, ) = class << self; self end .instance_eval { send(:define_method,"query_#{method.to_s}") do |*opts| results = @design.view(view, .merge(opts.first || {})) if [:include_docs] results["rows"].map! {|row| self.new(row["doc"]) } end QueryResult.new(results) end } end |