Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove excludes from output; support for ORMless field definitions

  • Loading branch information...
commit 74798b30f207523c3bcbb31bc5f2b3cbcda35b59 1 parent 7cfcc96
Bantik authored
Showing with 7 additions and 3 deletions.
  1. +1 −1  lib/faceted/has_object.rb
  2. +6 −2 lib/faceted/presenter.rb
View
2  lib/faceted/has_object.rb
@@ -59,7 +59,7 @@ def save
end
def schema_fields
- self.class.fields - self.excludes
+ self.class.fields - self.excludes - [:excludes]
end
def to_hash
View
8 lib/faceted/presenter.rb
@@ -31,8 +31,12 @@ def presents(name, args={})
def where(args)
if klass.respond_to? :fields
- # Mongoid
- attrs = args.select{|k,v| klass.fields.keys.include? k.to_s}
+ if klass.fields.respond_to?(:keys)
+ # Mongoid
+ attrs = args.select{|k,v| klass.fields.keys.include? k.to_s}
+ else
+ attrs = args.select{|k,v| klass.fields.include? k.to_s}
+ end
else
# ActiveRecord et al
attrs = args.select{|k,v| klass.column_names.include? k.to_s}
Please sign in to comment.
Something went wrong with that request. Please try again.