Permalink
Browse files

Hack to add support for dynamic segments

Props to @stevenwilkin
  • Loading branch information...
1 parent 72ce3c6 commit 2e5f78bfb05e704136979c1e610175184da95aa6 @Sija committed Mar 21, 2013
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/garb/model.rb
View
10 lib/garb/model.rb
@@ -77,8 +77,14 @@ def parse_filters(options)
end
def parse_segment(options)
- segment_id = "gaid::#{options[:segment_id].to_i}" if options.has_key?(:segment_id)
- { 'segment' => segment_id }
+ # dirty hack to support dynamic segments
+ if options.has_key?(:segment_id)
+ segment = "gaid::#{options[:segment_id].to_i}"
+ elsif options.has_key?(:dynamic_segment)
+ filters = FilterParameters.new(options[:dynamic_segment])
+ segment = "dynamic::#{filters.to_params['filters']}"
+ end
+ {'segment' => segment}
end
def parse_sort(options)

0 comments on commit 2e5f78b

Please sign in to comment.