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 dynamic drop-down with mongoid in rails. Finally I become success to implement full featured rails dynamic drop down with mongoid and coffeescript.
Find the source code in github:
First of all you make sure that mongodb is installed.
If you want to copy and customize the app with changes that are only useful for your own project, you can clone the GitHub repo. You probably should generate the app instead (see below). To clone:
$ git clone git://github.com/gkunwar/dynamic-dropdown.git
Then install the bundle and run the application.
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 using following method.
d1 = “12/2/2012″
d2 = “15/2/2012″
d1 = d1.to_date
d2 = d2.to_date
no_of_days = (d2-d1).to_i
Finally, I get number of days between two date. If there are any better methods for this operation, suggestions are welcome.
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 the complete report.