Skip to content

Commit

Permalink
Hack to cover Rails' polymorphic paths
Browse files Browse the repository at this point in the history
  • Loading branch information
jcasimir committed Jul 11, 2011
1 parent ea9ed66 commit b537f98
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/draper/base.rb
Expand Up @@ -5,14 +5,15 @@ class Base
include ActionView::Helpers::TextHelper include ActionView::Helpers::TextHelper


require 'active_support/core_ext/class/attribute' require 'active_support/core_ext/class/attribute'
class_attribute :denied, :allowed class_attribute :denied, :allowed, :source_class
attr_accessor :source attr_accessor :source


DEFAULT_DENIED = Object.new.methods << :method_missing DEFAULT_DENIED = Object.new.methods << :method_missing
self.denied = DEFAULT_DENIED self.denied = DEFAULT_DENIED


def initialize(subject) def initialize(subject)
subject.inspect subject.inspect
self.source_class = subject.class
self.source = subject self.source = subject
build_methods build_methods
end end
Expand All @@ -36,6 +37,10 @@ def self.decorate(input)
def helpers def helpers
ActionController::Base.helpers ActionController::Base.helpers
end end

def self.model_name
ActiveModel::Name.new(source_class)
end


private private
def select_methods def select_methods
Expand Down
2 changes: 1 addition & 1 deletion lib/draper/version.rb
@@ -1,3 +1,3 @@
module Draper module Draper
VERSION = "0.3.4" VERSION = "0.3.5"
end end

0 comments on commit b537f98

Please sign in to comment.