Permalink
Browse files

Fix collection context so things like will_paginate will work with pr…

…esenters
  • Loading branch information...
1 parent a4ea76a commit 387def7fa299dc3b8afbea65dcc4ddd89db2bb49 Matthew Mongeau committed Jan 4, 2010
Showing with 7 additions and 4 deletions.
  1. +2 −1 .gitignore
  2. +3 −1 lib/presenter.rb
  3. +2 −2 presentable.gemspec
View
@@ -1 +1,2 @@
-*.gem
+*.gem
+.DS_Store
View
@@ -37,10 +37,12 @@ class CollectionPresenter
end
def initialize(nodes)
+ @context = nodes
@nodes = nodes.map{ |n| n.presenter }
end
def method_missing(method, *attrs, &block)
- @nodes.__send__(method, *attrs, &block)
+ return @nodes.__send__(method, *attrs, &block) if @nodes.respond_to?(method)
+ @context.__send__(method, *attrs, &block)
end
end
View
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{presentable}
- s.version = "0.1.2"
+ s.version = "0.1.3"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["toastyapps"]
- s.date = %q{2009-12-17}
+ s.date = %q{2010-01-04}
s.description = %q{Making presenters easy and fun!}
s.email = %q{matt@toastyapps.com}
s.files = [

0 comments on commit 387def7

Please sign in to comment.