midas-g_named_scope_filters 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ == 1.0.3 2009-04-17
2
+
3
+ * Fixed bug with resources scoped more than 1 level deep
4
+
1
5
  == 1.0.1 2009-04-16
2
6
 
3
7
  * Added namespace option
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{g_named_scope_filters}
5
- s.version = "1.0.2"
5
+ s.version = "1.0.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["C. Jason Harrelson (midas)"]
@@ -4,7 +4,7 @@ $:.unshift(File.dirname(__FILE__)) unless
4
4
  require 'g_named_scope_filters/view_helpers'
5
5
 
6
6
  module GNamedScopeFilters
7
- VERSION = '1.0.2'
7
+ VERSION = '1.0.3'
8
8
  end
9
9
 
10
10
  if defined?( ActionView::Base )
@@ -41,9 +41,9 @@ module GNamedScopeFilters
41
41
  end
42
42
  options[:filters] = filters
43
43
 
44
- scoped_by = options[:scoped_by] #options.delete( :scoped_by )
45
- polymorphic_type = options[:polymorphic_type] #options.delete( :polymorphic_type ).to_s if options.has_key?( :polymorphic_type )
46
- polymorphic_as = options[:polymorphic_as] #options.delete( :polymorphic_as ).to_s if options.has_key?( :polymorphic_as )
44
+ scoped_by = options[:scoped_by]
45
+ polymorphic_type = options[:polymorphic_type]
46
+ polymorphic_as = options[:polymorphic_as]
47
47
 
48
48
  raise "You must provide the 'polymorphic_as' option if you provide the 'polymorphic_type' option." if polymorphic_type && !polymorphic_as
49
49
 
@@ -63,18 +63,16 @@ module GNamedScopeFilters
63
63
 
64
64
  path_helpers = Guilded::Rails::Helpers.resolve_rest_path_helpers( ar_obj_col_or_class, options )
65
65
  list_path_helper = path_helpers[:index_rest_helper]
66
- #if options[:list_path_helper]
67
- # list_path_helper = options[:list_path_helper].to_s
68
- #elsif scoped_by
69
- # list_path_helper = "#{scoped_by.class.to_s.underscore}_#{klass.to_s.tableize}_path"
70
- #else
71
- # list_path_helper = "#{klass.to_s.tableize}_path"
72
- #end
73
66
 
74
67
  html = ''
75
68
 
76
69
  return html if filters.empty?
77
70
 
71
+ # Resolve scoped by if it is an array
72
+ if scoped_by.is_a?( Array )
73
+ scoped_by = scoped_by.last
74
+ end
75
+
78
76
  html << "<ul id=\"#{options[:id].to_s}\" class=\"#{options[:class].to_s}\">"
79
77
 
80
78
  # Handle the all filter
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: midas-g_named_scope_filters
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - C. Jason Harrelson (midas)