Get and Set method in Ruby on Rails

Hi,

I working on Ruby on Rails.I using Ajax in that.While using pagination
in my application first time only I want to give request to Mysql Data
Base ,If user click second page it should not take from database. Here
I can use Set and get methods or different method will be there. How
to implement this?

Ruby has attr_* for getters and setters:

http://www.ruby-doc.org/core/classes/Module.html#M001678

Well, you're not going to be doing this in Ruby, since HTTP is
stateless. Since you're using AJAX, you might as well store your
entire resultset as JS, and fetch each page from your local
collection. That said, maybe you should look at Mislav will_paginate
(http://github.com/mislav/will_paginate). Sure, you'll hit the DB for
each page, but it's simple to implement, it's well tested and it
performs reasonably well.

Cheers,
Tim