Rails-Dynamic-DropDown

I have found many codes and blog posts for dynamic drop down with mysql in rails. But I want to implement it with mongoid in my application. Many codes that I found are not perfectly working for this. Some gave me problem of non appearing data during edit. So I tried to develop my own…

Originally posted on Nasir Jamal:
[digg=http://digg.com/programming/Using_stored_procedures_in_rails] There is no documentation in Rails about how to use stored procedures or atleast it is difficult to find where to look at. And according to DHH stored procedures is not the Rails Way to do things. DHH mentioned in his post I want a single layer of cleverness:…

Originally posted on Eve Love Rails:
I have used CanCan plugin to manage authorization on my rails app, but it’s still static authorization. I just create code like this: def initialize(user) if user.admin? can :manage, :all else can :read, :all end end My app is getting bigger. There are users with many user types. Every user…

Originally posted on What You're Doing Is Rather Desperate:
I’ve been experimenting with MongoDB’s map-reduce, called from Ruby, as a replacement for Ruby’s Enumerable methods (map/collect, inject). It’s faster. Much faster. Next, the details but first – the disclaimers: My database is not optimised (using, e.g. indices) My non-map/reduce code is not optimised; I’m…

Ruby Arithmetic Operation for Date

I wanted to get the difference between two dates. My date are in format “DD/MM/YYYY”. I tried to get number of days between two date of same format. Finally I got an easy method to get number of day between these two date. For this first of all I changed these date to date format…

2012 in review

The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog. Here’s an excerpt: The new Boeing 787 Dreamliner can carry about 250 passengers. This blog was viewed about 1,300 times in 2012. If it were a Dreamliner, it would take about 5 trips to carry that many people. Click here to see…

Originally posted on Experience Satire:
accepts_nested_attributes_for is very useful when you want a single form to cater to multiple models. It gives you an easy way to include attributes from the associated tables and also to successfully save and delete objects. Consider a scenario where ‘House’ has many ‘Rooms’  and has one ‘Address’. It also…