JGailor-except 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
- data/lib/except.rb +1 -1
- data/test/except_spec.rb +7 -1
- metadata +1 -1
data/History.txt
CHANGED
data/lib/except.rb
CHANGED
@@ -7,7 +7,7 @@ module Except
|
|
7
7
|
def find_with_except(*args)
|
8
8
|
options = args.last.is_a?(::Hash) ? args.pop : {}
|
9
9
|
if exceptions = options.delete(:except)
|
10
|
-
options[:select] = (self.column_names - exceptions.split(
|
10
|
+
options[:select] = (self.column_names - exceptions.split(/\s*,\s*/)).join(", ")
|
11
11
|
end
|
12
12
|
args << options
|
13
13
|
find_without_except(*args)
|
data/test/except_spec.rb
CHANGED
@@ -14,6 +14,12 @@ describe User do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should only bring back all the fields except for the ones in the except clause" do
|
17
|
-
User.first(:except => "password").attribute_names.should_not include(
|
17
|
+
User.first(:except => "password").attribute_names.should_not include("password")
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should ignore spacing before and after fields in the :except clause" do
|
21
|
+
u = User.first(:except => "password , email")
|
22
|
+
u.attribute_names.should_not include("email")
|
23
|
+
u.attribute_names.should_not include("password")
|
18
24
|
end
|
19
25
|
end
|