Wednesday, February 25, 2009

Basically Pagination feature can done in no time using will_paginate plugin.Developers no need to worry about code development ,with this plugin two lines of code will give u pagination feature.
First we need to install the will_paginate plugin into application.
Following command will install plugin

>ruby script/plugin install svn://errtheblog.com/svn/plugins/will_paginate

Then need to add the pagination criteria ,i,e the number records to be displayed and name of the model etc..
For doing this follow this code

>@anyname=Modelname.paginate(:page => params[:page], :conditions =>["........'"],:per_page =>no_of_pages)

And then for viewing this pagination, we need to add following code in concerning .rhtml file

> <%= will_paginate @moment%>

This will allow to display pagination in rails application.

Monday, December 29, 2008

Installing ROR

1. Install Ruby
• Windows: Download the Windows installer (the first .exe file at http://
rubyforge.org/frs/?group id=167) and double-click on it.
• Linux: Download the Ruby source code from http://www.ruby-lang.org/
en/downloads/. Linux users, you know the drill: extract with
$ tar zxf
and install with
$ ./configure; make; sudo make install
If you don’t have sudo2 enabled, you’ll have to log in as root for the final
step:
$ ./configure
$ make
$ su
# make install
• OS X: There are some issues with the Ruby that ships with OS X 10.4, so you
might want to take a look at this:3 http://hivelogic.com/articles/2005/
12/01/ruby rails lighttpd mysql tiger
2. Install RubyGems, the standard Ruby package manager
• Windows: Download the first RubyGems .zip file from http://rubyforge.
org/frs/?group id=126 and unzip it, extracting the files to a directory on your
local disk. Using a command prompt (DOS window), navigate to the directory
where you extracted the files and run
> ruby setup.rb
• Linux and OS X: Download the first RubyGems .tgz file from http://
rubyforge.org/frs/?group id=126, extract it, and run
$ ruby setup.rb
inside the source directory.
3. Install Rails at the command line:4
> gem install rails --include-dependencies