belongs_to_enum 0.3 → 0.3.1

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.
@@ -82,7 +82,7 @@ module BelongsToEnum
82
82
  if options[:create_scopes]
83
83
  klass.raw_hash.each do |key, value|
84
84
  parent.instance_exec do
85
- scope key.to_s.pluralize, where("#{name.to_s.underscore}_id" == value)
85
+ scope key.to_s, where("#{name.to_s.underscore}_id = #{value}")
86
86
  end
87
87
  end
88
88
  end
@@ -1,3 +1,3 @@
1
1
  module BelongsToEnum
2
- VERSION = "0.3"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -127,11 +127,11 @@ describe "Belongs To Enum models" do
127
127
  belongs_to_enum :role2, [:admin]
128
128
  end
129
129
  klass.should respond_to("sanity_scope")
130
- klass.should respond_to("normals")
131
- klass.should_not respond_to("admins")
130
+ klass.should respond_to("normal")
131
+ klass.should_not respond_to("admin")
132
132
 
133
- klass.method("normals").source_location.should == klass.method("sanity_scope").source_location
134
- klass.send("normals").to_sql.strip.should == 'SELECT "scope_checkers".* FROM "scope_checkers"'
133
+ klass.method("normal").source_location.should == klass.method("sanity_scope").source_location
134
+ klass.send("normal").to_sql.strip.squeeze(" ").should == 'SELECT "scope_checkers".* FROM "scope_checkers" WHERE (role1_id = 1)'
135
135
  end
136
136
 
137
137
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: belongs_to_enum
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: "0.3"
5
+ version: 0.3.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jeremy walker