Skip to content

Commit

Permalink
Cleaning up the merge that removes lazy_helpers method
Browse files Browse the repository at this point in the history
  • Loading branch information
jcasimir committed Oct 20, 2011
2 parents c4c54d3 + 1a74447 commit 6438829
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
2 changes: 1 addition & 1 deletion Readme.markdown
Expand Up @@ -198,7 +198,7 @@ Hate seeing that `h.` proxy all over? Willing to mix a bazillion methods into yo
```ruby
class ArticleDecorator < ApplicationDecorator
decorates :article
lazy_helpers
include Draper::LazyHelpers

def published_at
date = content_tag(:span, model.published_at.strftime("%A, %B %e").squeeze(" "), :class => 'date')
Expand Down
10 changes: 0 additions & 10 deletions lib/draper/base.rb
Expand Up @@ -105,16 +105,6 @@ def helpers
end
alias :h :helpers

# Calling `lazy_helpers` will make the built-in and
# user-defined Rails helpers accessible as class methods
# in the decorator without using the `h.` or `helpers.` proxy.
#
# The drawback is that you dump many methods into your decorator's
# namespace and collisions could create unexpected results.
def self.lazy_helpers
self.send(:include, Draper::LazyHelpers)
end

# Fetch the original wrapped model.
#
# @return [Object] original_model
Expand Down
7 changes: 0 additions & 7 deletions spec/base_spec.rb
Expand Up @@ -26,13 +26,6 @@
end
end

context(".lazy_helpers") do
it "makes Rails helpers available without using the h. proxy" do
Draper::Base.lazy_helpers
subject.send(:pluralize, 5, "cat").should == "5 cats"
end
end

context(".decorates") do
it "sets the model class for the decorator" do
ProductDecorator.new(source).model_class.should == Product
Expand Down

0 comments on commit 6438829

Please sign in to comment.