Selecting Indian States in Rails

Ruby on Rails Blog

Just last week I coded a miracle Rails app. I say miracle because there was no client pressure. I had never seen like it. Though it was my friend, a client is a client, he must be stupid. Ones who are not, are not clients. Finishing ecommerce application less than a week made no sense to me, and I did it. That’s stupid.

Okay there was stage when I had to put a select box for selecting Indian states. I searched and found this excellent gem called carmen. I included it in gem file and I was able to put a select box for Indian states using this code

Well, the above code is in haml. However newly formed Telengana hasn’t reflected yet.

View original post


MongoDB text indexing in action

Josh Software - Where Programming is an Art!

Recently, I had a good use-case to use MongoDB text-indexing and I gave it a shot. I found it to be pretty awesome – even though its not have full-fledged text-search engine capabilities (like facets etc.) it does the job for simple text searches.

So, what did we want to do? We had the following model

Now, we had to search for people like “John Doe” or “Jane” or with email “”. I decided to give text indexing a shot.

Some of the salient features of text indexing are tokenizing, stemming and relevance scores. Basically, the words are split using the default token (white space), there is support for multiple languages and each result has a weightage score which tells us how relevant that result was.

Getting Started

To get started, you need to enable text-indexing. You can do this in 2 ways:

Add the following text to your mongod.conf file…

View original post 550 more words

Real Time notifications using slanger and sidekiq

rails learning

With the increasing expectation of web-applications, everyone wants real time updates or real time notifications to improve the web portals user experience. Understandably, my project required Real time notifications too. I successfully implemented and deployed on production. During my development I found some interesting gems, javascript libraries that I came across. So I thought it would be helpful if I share my experience. To make it more useful I have created a sample repository for demonstrating Real Time notifications for your further reference.

The AIM: Notify the user with a reminder on specific user defined date and time using Web notifications.

I choose slanger gem. (Recently updated by Jiren to make it compatible with rails4). To make it work, add pusher to rails app and for slanger instead of adding it in rails Gemfile, I created a sub directory called ‘slanger’ in my rails project and added slanger. Now we are done with…

View original post 294 more words

20 Reasons Why Every Web Designer Needs to Learn Rails [ROR Network]

RoR Muthukrishnan


She told me her husband was being downsized. He was 52 years old, been with the company for twenty. He was a COBOL man. Nothing but a COBOL man his entire career. But the company needed more than a COBOL man. So they let him go.

That is a true story. It’s about ten years old. But it’s not an uncommon story, especially in today’s rapidly-changing tech environment and somewhat dismal economy.

In fact, you probably know somebody that’s been let go or overlooked because of a lack in a certain skill set. The only difference is that you don’t have to wait until your early fifties to get downsized.

Today that can happen at 30. Even 25.

Enter Ruby on Rails

Typically the guy or gal with the most developing tools under their belt wins. It leads to the sweetest projects. The most perks. The best salary.

This is…

View original post 1,950 more words

Single Page Application Done Right

Web Development Insights

Single Page What?!

Not too long ago, moved its website from classic web architecture (CWA) to a single-page application (SPA). For those who are less familiar with SPA, the major differences between the two are as follows:

  1. First client request:
    • CWA: The server returns a full HTML page
    • SPA: The server returns a set of templates and data which is then rendered to the full HTML page, by Javascript, on the client side.
  2. Subsequent requests
    • CWA: The server returns a full HTML page
    • SPA: The server returns only the data needed to display the request. Since all templates are already on the client side from the first request, no HTML/CSS/JS should be delivered.

To put it in simpler words – while in CWA the client gets a full HTML page on each request, in SPA the client gets all needed to be able to render the HTML by itself…

View original post 1,034 more words

To Unit Test or not to Unit Test


It seems like some dust has been stirred up around the issue of unit testing and the role that unit tests should play in a developer’s overall TDD strategy. After reading through some writings on ‘con’ side, I’m finding the issue very thought-provoking, specifically in regards to the relationship of unit tests and code design.

Before moving on though, let’s draw a distinction between the general concept of TDD (writing tests to help you define your needs and design your program) and unit testing (testing specifically of models and model methods). These are often lumped together, and many people think of TDD only as unit testing. This is not necessarily the case, and, as I’ll try to feel out, this conflation may be the cause of the current debate.

When I was taught TDD, the emphasis was on using unit tests to help you design your methods — by specifying the method’s…

View original post 1,165 more words