diff options
author | jessib <jessib@leap.se> | 2013-01-17 10:39:15 -0800 |
---|---|---|
committer | jessib <jessib@leap.se> | 2013-01-17 10:39:15 -0800 |
commit | 7d7741f7d26c3ae7ee1dc347a6b1a1142a3c2824 (patch) | |
tree | 5ec11b9600d4330ec94f56dda779634cd7dcae1b /core/lib/extensions | |
parent | 2485527650c4832d764d318e91c10bafde8b8ae5 (diff) | |
parent | b550cd14f33b9664fe6b547dc56107fae7d12caf (diff) |
Merge branch 'master' into feature/unauthenticated_tickets
Conflicts:
help/app/views/tickets/_comment.html.haml
help/app/views/tickets/_new_comment.html.haml
Diffstat (limited to 'core/lib/extensions')
-rw-r--r-- | core/lib/extensions/couchrest.rb | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/core/lib/extensions/couchrest.rb b/core/lib/extensions/couchrest.rb index a8da23b..5938df4 100644 --- a/core/lib/extensions/couchrest.rb +++ b/core/lib/extensions/couchrest.rb @@ -1,8 +1,23 @@ -class CouchRest::Model::Designs::View - - # so we can called Ticket.method.descending or Ticket.method.ascending - def ascending - self - end +module CouchRest::Model::Designs + + class View + + # so we can called Ticket.method.descending or Ticket.method.ascending + def ascending + self + end + end + + class DesignMapper + def load_views(dir) + Dir.glob("#{dir}/*.js") do |js| + name = File.basename(js, '.js') + file = File.open(js, 'r') + view name.to_sym, + :map => file.read, + :reduce => "function(key, values, rereduce) { return sum(values); }" + end + end + end end |