active_enum 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ [0.9.6] : 2011-09-13
2
+ - Fix regression in active_enum_for in models without enumerated attributes. (issue #8). [jasoncodes]
3
+
1
4
  [0.9.5] : 2011-09-11
2
5
  - Fix regression in enumerate method to not override set of enumerated attributes with each call. [TeWu]
3
6
 
@@ -51,7 +51,7 @@ module ActiveEnum
51
51
  end
52
52
 
53
53
  def active_enum_for(attribute)
54
- enumerated_attributes[attribute.to_sym]
54
+ enumerated_attributes && enumerated_attributes[attribute.to_sym]
55
55
  end
56
56
 
57
57
  def define_active_enum_methods_for_attribute(attribute)
@@ -1,3 +1,3 @@
1
1
  module ActiveEnum
2
- VERSION = '0.9.5'
2
+ VERSION = '0.9.6'
3
3
  end
@@ -62,6 +62,13 @@ describe ActiveEnum::FormHelpers::Formtastic, :type => :helper do
62
62
  output.should have_selector('input#person_first_name')
63
63
  end
64
64
 
65
+ it "should allow models without enumerated attributes to behave normally" do
66
+ output = semantic_form_for(NoEnumPerson.new, :url => people_path) do |f|
67
+ concat f.input(:first_name)
68
+ end
69
+ output.should have_selector('input#no_enum_person_first_name')
70
+ end
71
+
65
72
  def people_path
66
73
  '/people'
67
74
  end
@@ -63,6 +63,13 @@ describe ActiveEnum::FormHelpers::SimpleForm, :type => :helper do
63
63
  output.should have_selector('input#person_first_name')
64
64
  end
65
65
 
66
+ it "should allow models without enumerated attributes to behave normally" do
67
+ output = simple_form_for(NoEnumPerson.new, :url => people_path) do |f|
68
+ concat f.input(:first_name)
69
+ end
70
+ output.should have_selector('input#no_enum_person_first_name')
71
+ end
72
+
66
73
  def people_path
67
74
  '/people'
68
75
  end
data/spec/spec_helper.rb CHANGED
@@ -26,6 +26,9 @@ ActiveRecord::Base.establish_connection({:adapter => 'sqlite3', :database => ':m
26
26
  require 'schema'
27
27
 
28
28
  class Person < ActiveRecord::Base; end
29
+ class NoEnumPerson < ActiveRecord::Base
30
+ set_table_name 'people'
31
+ end
29
32
 
30
33
  class NotActiveRecord
31
34
  include ActiveModel::Validations
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_enum
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 55
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 5
10
- version: 0.9.5
9
+ - 6
10
+ version: 0.9.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Adam Meehan
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-11 00:00:00 +10:00
18
+ date: 2011-09-13 00:00:00 +10:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency