public
Description: Makes your models act as textiled.
Homepage: http://errtheblog.com/posts/12-actsastextiled
Clone URL: git://github.com/defunkt/acts_as_textiled.git
refactor tests for acts_as_textiled completely
defunkt (author)
Sun Jun 03 04:24:33 -0700 2007
commit  d5fd7eebebede89cb9ffc152d6e08d2364df9bc0
tree    36006e9d3a9678aec5a0b39f4f7173899d2f3b9c
parent  da225b46cdbeff935586eaa2b03686763984eb38
...
8
9
10
11
12
13
14
...
17
18
19
20
 
21
22
23
...
26
27
28
 
 
 
 
29
30
31
...
34
35
36
37
 
38
39
40
...
52
53
54
55
 
56
57
58
...
8
9
10
 
11
12
13
...
16
17
18
 
19
20
21
22
...
25
26
27
28
29
30
31
32
33
34
...
37
38
39
 
40
41
42
43
...
55
56
57
 
58
59
60
61
0
@@ -8,7 +8,6 @@ module Err
0
       module ClassMethods
0
         def acts_as_textiled(*attrs)
0
           @textiled_attributes = []
0
- def textiled_attributes; Array(@textiled_attributes) end
0
 
0
           @textiled_unicode = "".respond_to? :chars
0
 
0
@@ -17,7 +16,7 @@ module Err
0
 
0
           attrs.each do |attr|
0
             define_method(attr) do
0
- textiled[attr.to_s] ||= RedCloth.new(read_attribute(attr), Array(ruled[attr])).to_html if read_attribute(attr)
0
+ textiled[attr.to_s] ||= RedCloth.new(self[attr], Array(ruled[attr])).to_html if self[attr]
0
             end
0
             define_method("#{attr}_plain", proc { strip_redcloth_html(__send__(attr)) if __send__(attr) } )
0
             define_method("#{attr}_source", proc { __send__("#{attr}_before_type_cast") } )
0
@@ -26,6 +25,10 @@ module Err
0
 
0
           include Err::Acts::Textiled::InstanceMethods
0
         end
0
+
0
+ def textiled_attributes
0
+ Array(@textiled_attributes)
0
+ end
0
       end
0
 
0
       module InstanceMethods
0
@@ -34,7 +37,7 @@ module Err
0
         end
0
 
0
         def textiled?
0
- @is_textiled || true
0
+ @is_textiled != false
0
         end
0
 
0
         def textiled=(bool)
0
@@ -52,7 +55,7 @@ module Err
0
 
0
         def write_attribute(attr_name, value)
0
           textiled[attr_name.to_s] = nil
0
- super(attr_name, value)
0
+ super
0
         end
0
 
0
       private

Comments

    No one has commented yet.