Paginate with only some columns

Hi,

I use scaffold to generate against a model and controller…

Then, I modify the controller code, and rewrite paginate method with
:select => [“col1, col2, col5”] so that it only retrieves the columns I
wanted…

But, :select does not work and it seems that it selects all the columns
of the underlying table…

What am I missing ?

Thanks…

Bu e-posta mesaji, mesajin alici kisminda belirtilmis olan kullanici
icindir. Mesajin alicisi siz degilseniz dogrudan veya dolayli olarak
mesaji kullanmayiniz, acmayiniz, dagitmayiniz, yazicidan dokumunu
almayiniz veya herhangi bir kismini kopyalamayiniz. Yanlislikla bu mesaj
size ulasmissa lutfen, siliniz ve tum kopyalarini yok ederek mesaji
gonderene acilen haber veriniz. Bu mesaj icerisinde belirtilenler sadece
gondericinin kisisel gorusleridir. Bu gorusler Sermaye Piyasasi Kurulu’
nun (SPK) goruslerini yansitmadigi gibi, SPK’ yi baglayici da degildir.
Bu mesajin icerisinde ya da eklerinde yer alan bilgilerin dogrulugu,
butunlugu ve guncelligi SPK tarafindan garanti edilmemektedir ve bilinen
viruslere karsi kontrolleri yapilmis olarak yollanan mesajin sitenizde
yaratabilecegi zararlardan SPK sorumlu tutulamaz.

This email is intended solely for the use of the individual or entity to
whom it is adressed. If you are not the intended addressee of this
message, you should not use, open, disseminate, distrubute, print or
copy this e-mail. If you have received this email in error, please
delete it from your system and notify the sender immediately. The
Capital Markets Board of Turkey (CMB) does not accept any legal
responsibility whatsoever for the contents of this message. Any opinions
contained in this message are those of the author and are not given or
endorsed by the CMB. The CMB does not warrant the accuracy, integrity
and currency of the information transmitted with this message. This
message has been detected for all known computer viruses thence CMB is
not liable for the occurrence of any system corruption caused by this
message.

Leave the controller code as it was. Let the action fetch all the
fields. Just modify the view to display only the desired columns. It’s
much easier.

Erhan ERÄ°Å?KEN wrote:

Hi,

I use scaffold to generate against a model and controller…

Then, I modify the controller code, and rewrite paginate method with
:select => [“col1, col2, col5”] so that it only retrieves the columns I
wanted…

But, :select does not work and it seems that it selects all the columns
of the underlying table…

What am I missing ?

Thanks…