Permalink
Browse files

Hack to cover Rails' polymorphic paths

  • Loading branch information...
1 parent ea9ed66 commit b537f98ef526b07276a267e1b9ede1d73a793dca @jcasimir jcasimir committed Jul 11, 2011
Showing with 7 additions and 2 deletions.
  1. +6 −1 lib/draper/base.rb
  2. +1 −1 lib/draper/version.rb
View
@@ -5,14 +5,15 @@ class Base
include ActionView::Helpers::TextHelper
require 'active_support/core_ext/class/attribute'
- class_attribute :denied, :allowed
+ class_attribute :denied, :allowed, :source_class
attr_accessor :source
DEFAULT_DENIED = Object.new.methods << :method_missing
self.denied = DEFAULT_DENIED
def initialize(subject)
subject.inspect
+ self.source_class = subject.class
self.source = subject
build_methods
end
@@ -36,6 +37,10 @@ def self.decorate(input)
def helpers
ActionController::Base.helpers
end
+
+ def self.model_name
+ ActiveModel::Name.new(source_class)
+ end
private
def select_methods
@@ -1,3 +1,3 @@
module Draper
- VERSION = "0.3.4"
+ VERSION = "0.3.5"
end

0 comments on commit b537f98

Please sign in to comment.