1
0
Fork 0
mirror of https://github.com/drapergem/draper synced 2023-03-27 23:21:17 -04:00

Cleaning up the merge that removes lazy_helpers method

This commit is contained in:
Jeff Casimir 2011-10-19 22:03:03 -04:00
commit 6438829e3a
3 changed files with 1 additions and 18 deletions

View file

@ -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')

View file

@ -105,16 +105,6 @@ module Draper
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

View file

@ -26,13 +26,6 @@ describe Draper::Base do
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