Author Archives for Akhil Bansal

Configuring Multiple Rails Application with Lighttpd


I was using lighttpd web server for my Rails applications.
In development mode I was starting lighttpd server from the rails application directory by
lighttpd -D -f config/lighttpd.conf
But I was facing problem when I tried to run multiple rails applications in production mode. After some trials I succeded.
I inserted the following lines of code in my /etc/lighttpd/lighttpd.conf […]

Cartographer: A Google maps API in Rails


If you want to insert google maps in your rails application, then you can use cartographer.
This is still in development.

Plugin: cssForm


AD.D SoftWare have developed a new plugin for Rails called cssForm that lets you create forms without tables, entirely using CSS.
The interesting thing about this plugin is the way it lets you wrap certain behavior around standard elements. This technique could be very useful to pick about and redevelop for your own preferences.

How to search for a string on multiple fields across multiple joined tables in Rails


In my project I have to write a search controller, in which I have to search for a string on multiple fields across join tables.
There are two controllers Project, Publication and two models project and publication.
Project has many publication and publication belongs to project.
I wanted to search for a string on all fields of project […]

Plugin: file_column


This is straight from the “file_column website”:http://www.kanthak.net/opensource/file_column/:
Just make the “image” column ready for handling uploaded files…
class Entry < ActiveRecord::Base
file_column :image
end
… generate file fields *that keep uploaded images during form redisplays to your view…
<%= file_column_field “entry”, “image” %>
… and display uploaded images in your view:
<%= image_tag url_for_file_column(”entry”, “image”) %>
However, you may want […]

Rails: Issuing direct query to database


You can issue direct query to database by:
result = ActiveRecord::Base.connection.execute(”SELECT * from tablename”)
and fetch hash:
a=result.fetch_hash

Plugin: NumbersToWords


In my RAILS application I need to convert numbers to words. I started writing own function but before I finish that I got an amazing Plugin.
This Plugin is capable to convert number to words.
Following are some examples
>> 5.to_english
=> “five”
>> 123456.to_english
=> “one hundred twenty-three thousand four hundred and fifty-six”
>> 2.5.to_english
=> “two”
>> (2.5).to_english
=> “two”
>> (2.5).to_dollars
=> “two dollars […]

Ajax Scaffold Generator


I was searching for something about rails and find a very interesting thing. The Ajax Scaffold Generator.
The ajax scaffold generator is just too simple!.
One thing you must remember if using this ajax scaffold generator is that the browser back buttn might not work. I liked it very much and highly recomend this tool.
you can install […]

Optimize your rails application


If you want to speed up your Rails applicatoin, Please read this article…I think this can help you….
http://www.infoq.com/articles/Rails-Performance

Akhil Bansal

Myself Akhil Bansal from New Delhi, India. I have about two years of web programming experience. I work with Vinayak Solutions Pvt. Ltd, a Ruby on Rails leading company in New Delhi, India. I started my career with PHP but now I am enjoying Ruby and Ruby On Rails since last year. This blog is all about my experiences with Ruby on Rails and others. Hire Me: I’m available for contract work. Contact me at [bansalakhil30.10 at gmail dot com] if you’re interested.