Commit 26f8561568209b5289bc768893588759f31584f7

Authored by Victor Costa
1 parent 2a8d9898

rails3: fix file_presenter

Showing 1 changed file with 3 additions and 3 deletions   Show diff stats
lib/file_presenter.rb
@@ -8,8 +8,8 @@ class FilePresenter @@ -8,8 +8,8 @@ class FilePresenter
8 def self.for(f) 8 def self.for(f)
9 return f if f.is_a? FilePresenter 9 return f if f.is_a? FilePresenter
10 klass = FilePresenter.subclasses.sort_by {|class_name| 10 klass = FilePresenter.subclasses.sort_by {|class_name|
11 - class_name.constantize.accepts?(f) || 0  
12 - }.last.constantize 11 + class_name.accepts?(f) || 0
  12 + }.last
13 klass.accepts?(f) ? klass.new(f) : f 13 klass.accepts?(f) ? klass.new(f) : f
14 end 14 end
15 15
@@ -88,7 +88,7 @@ class FilePresenter @@ -88,7 +88,7 @@ class FilePresenter
88 # required `FilePresenter::Image` instance in the `image` variable. 88 # required `FilePresenter::Image` instance in the `image` variable.
89 def to_html(options = {}) 89 def to_html(options = {})
90 file = self 90 file = self
91 - lambda do 91 + proc do
92 render :partial => file.class.to_s.underscore, 92 render :partial => file.class.to_s.underscore,
93 :locals => { :options => options }, 93 :locals => { :options => options },
94 :object => file 94 :object => file