# Doubts about ruby

**URL:** <https://www.ruby-forum.com/t/doubts-about-ruby/172116>\
**Category:** Ruby\
**Created:** [July 15, 2009, 4:24am UTC](https://www.ruby-forum.com/t/doubts-about-ruby/172116 "2009-07-15T04:24:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![malev05](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5fc32e/32.png) [@malev05](https://www.ruby-forum.com/u/malev05)\
**Post date:** [July 15, 2009, 4:24am UTC](https://www.ruby-forum.com/t/doubts-about-ruby/172116/1 "2009-07-15T04:24:54Z")

</div>

Hi i’ve made an extension for sinatra using datamapper. And I based my  
code in some examples that I’ve found in github.  
Now, there are some parts of the code that are not very clear:

[http://pastie.org/546323](http://pastie.org/546323)

Why do I have to call all this mode … mode … mode to add an  
extension to Datamapper::Is module?

[http://pastie.org/546324](http://pastie.org/546324)  
In line 15. In some way I count how many items does the collection has:

@post = Post.is\_paginated  
@posts = Post.paginate

How does this block get the type of the collection and the name of the  
modoel?  
To use this extension I have to call the is\_paginated method first. Why  
is that? and Is there any automated way to do it?

The complete code of the extension is in here:  
[http://github.com/malev/sinatra-dm-paginate/tree/master](http://github.com/malev/sinatra-dm-paginate/tree/master)

Thanks for all!
