Wednesday, September 26, 2007

HOW TO HANDLE EXCEPTIONS ON RAILS

It is not nice to display an error page full of errors to the user who is using your web application when there is actually some error.Sounds weird, but its true.A layman would never liked to be thrown on a error page.To avoid error display to the user you can do the following in your rails application.

Go to [path of the rails applaication]/apps/config/environments/development.rb
and make a env variable as false in the file


config.action_controller.consider_all_requests_local = false(by default it will be true)


Go to [path of the rails applaication]/apps/controllers/application.rb
add the below text in above mentioned file.

def rescue_action_in_public(exception)
render :text => '[Your html body]'
end


def local_request?
false
end


Thats it .. now dont let your user know that what are you cooking in the other corner... simple na.....:)...Thanks to Raghavedra who helped me for this article

Tuesday, September 25, 2007

RAILS ON APACHE FOR LINUX
This is my first blog so please dont curse me to the core.Im just writing this for my interest and knowledge as i hat noting down in a book.Any other person who is interested to go on is alwayz welcome.I am very new to rails, n i love experimenting.Given i can start blabbering. So lets start with our procedures
This blog basically deals with installation procedures from scratch.As i have gone through lot of sites , i didnt find one place which specifies about RUNNING RAILS ON APACHE ON LINUX as whole complete package may this can help u.

To run rails on apache server u may need the following installations to be done.If you have the knowledge that you have done these installations then you can skip them

1 Installations
List of installations are:
1)Ruby Installation
2)Ruby Gems Installation
3)RAILS Installation
4)Apache Installation
5)FastCGI Installtion
6)ModFASTCGI Installation
7)fastcgigem installation

Before you start anything , a prerequisite before starting is that your box or machine should be connected to internet, otherwise installing gems will be difficult(But not impossible!!!).
1.1
Ruby Installation
You can install the latest version of the ruby from the source forge and follow the steps below.




2 Ruby Gems Installation
You can install the latest version of the ruby gems from the source forge and follow the below given steps to install ruby gems on the machine



3 RAILS Installation
You can install the latest version of the rails by following the below



    • gem install rails
    • :
    • Install required dependency rake? [Yn] y
    • Install required dependency activesupport? [Yn] y
    • Install required dependency activerecord? [Yn] y
    • Install required dependency actionpack? [Yn] y
    • Install required dependency actionmailer? [Yn] y
    • Install required dependency actionwebservice? [Yn] y
4 Apache Installation
You can install the latest version of the httpd from the source forge and following the below given steps to install ruby gems on the machine



5 Fast CGI Installation
You can install the latest version of the fcgi from the source forge.fcgi installer and following the below given steps to install fastcgi on the machine



6 mod_fcgi Installation
You can install the latest version of the mod_fcgi from the source forgeand following the below given steps to install fastcgi on the machine




7 fcgi gem Installation
You can install the latest version of the fcgi gem by following the below



    • gem install fcgi