doubts about ruby

M

Marcos Vanetta

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

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

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

Thanks for all!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,171
Messages
2,570,935
Members
47,472
Latest member
KarissaBor

Latest Threads

Top