acts_as_statused 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/acts_as_statused.rb +11 -8
  2. metadata +4 -4
@@ -20,21 +20,24 @@ module ActiveRecord #:nodoc:
20
20
  class_name = options.to_s if options.is_a?(Symbol) || options.is_a?(String)
21
21
  class_name = options[:class_name] if options.is_a?(Hash)
22
22
  class_name = "Status" if class_name.blank?
23
+
24
+ column_name = :status_id
25
+ column_name = (options[:column_name] || :status_id).to_sym if options.is_a?(Hash)
23
26
 
24
27
  #puts "!!!!!!!!!!!class_name = #{class_name}"
25
28
 
26
29
  class_eval do
27
- belongs_to :status
30
+ eval("belongs_to :status, :class_name => \"#{class_name}\"")
28
31
 
29
32
  attr_accessor :previous_status
30
-
31
- def after_find
32
- self.previous_status = self.status if respond_to?:status_id
33
- end
34
33
 
35
34
  eval %{
35
+ def after_find
36
+ self.previous_status = self.status if respond_to?(:#{column_name})
37
+ end
38
+
36
39
  def status
37
- #{class_name}.get(self.status_id)
40
+ #{class_name}.get(self.#{column_name})
38
41
  end
39
42
  }
40
43
 
@@ -81,8 +84,8 @@ module ActiveRecord #:nodoc:
81
84
  }
82
85
  end
83
86
  rescue => ex
84
- puts "Error in acts_as_statused: #{ex.message}"
85
- puts ex.backtrace
87
+ #puts "Error in acts_as_statused: #{ex.message}"
88
+ #puts ex.backtrace
86
89
  end
87
90
  end
88
91
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: acts_as_statused
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.3
7
- date: 2007-02-28 00:00:00 -05:00
6
+ version: 1.0.4
7
+ date: 2007-04-04 00:00:00 -04:00
8
8
  summary: Acts as Statused
9
9
  require_paths:
10
10
  - lib
@@ -52,7 +52,7 @@ dependencies:
52
52
  version_requirement:
53
53
  version_requirements: !ruby/object:Gem::Version::Requirement
54
54
  requirements:
55
- - - ">="
55
+ - - ">"
56
56
  - !ruby/object:Gem::Version
57
- version: 1.2.1
57
+ version: 0.0.0
58
58
  version: